Manually set working directory to source file location (Session Tab)

library(readxl)
## Warning: package 'readxl' was built under R version 4.1.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.3
## Warning: package 'tibble' was built under R version 4.1.3
## Warning: package 'tidyr' was built under R version 4.1.3
## Warning: package 'readr' was built under R version 4.1.3
## Warning: package 'purrr' was built under R version 4.1.3
## Warning: package 'stringr' was built under R version 4.1.3
## Warning: package 'forcats' was built under R version 4.1.3
## Warning: package 'lubridate' was built under R version 4.1.3
## -- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
## v forcats   1.0.0     v readr     2.1.4
## v ggplot2   3.4.4     v stringr   1.5.0
## v lubridate 1.9.2     v tibble    3.2.1
## v purrr     1.0.1     v tidyr     1.3.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
## i Use the ]8;;http://conflicted.r-lib.org/conflicted package]8;; to force all conflicts to become errors
library(ggplot2)
library(broom)
## Warning: package 'broom' was built under R version 4.1.3

TO DO -

REDO INTERPRETATION SECTION WITH UDPATED RACE AND MS SUBTYPE COLUMNS

Home videos - Log T25FW still not super linear… -> drop outliers?

Home videos - re-do with improved vel pixel proxy metrics

Load and format In-Person Video Data

All videos included in analysis. Videos were included based on if a walking segment could be identified. Some participants may have both a fast walk and preferred walking speed video. Some may have just fast walk or just preferred walking speed.

Each row = 1 video

Preferred walking speed

# Preferred Walking Speed 
zeno_pws_df <- read.csv("C:/Users/mmccu/Box/MM_Personal/5_Projects/BoveLab/3_Data_and_Code/gait_bw_zeno_home_analysis/004/000_merged_cleaned_data/zv_bw_merged_gait_vertical_PWS_1_clean.csv")
table(zeno_pws_df$task_pose)
## 
## gait_vertical_PWS_1 
##                 217
# assign levels to categorical variables 
table(zeno_pws_df$race_ethnicity_clean)
## 
##                     Asian Black Or African American        Hispanic or Latino 
##                        17                        14                        20 
##    Other/Unknown/Declined        White Not Hispanic 
##                        18                       148
zeno_pws_df$race_ethnicity_clean <- factor(zeno_pws_df$race_ethnicity_clean, 
                                           levels = c('Asian', 
                                                      'Black Or African American',
                                                      'Hispanic or Latino',
                                                      'White Not Hispanic',
                                                      'Other/Unknown/Declined'), 
                                           ordered = FALSE)
print(levels(zeno_pws_df$race_ethnicity_clean))
## [1] "Asian"                     "Black Or African American"
## [3] "Hispanic or Latino"        "White Not Hispanic"       
## [5] "Other/Unknown/Declined"
table(zeno_pws_df$ms_dx_condensed)
## 
## MS, Subtype Not Specified            Progressive MS                      RRMS 
##                         2                        37                       178
zeno_pws_df$ms_dx_condensed <- factor(zeno_pws_df$ms_dx_condensed, 
                                           levels = c('RRMS', 
                                                      'Progressive MS',
                                                      'MS, Subtype Not Specified'), 
                                           ordered = FALSE)
print(levels(zeno_pws_df$ms_dx_condensed))
## [1] "RRMS"                      "Progressive MS"           
## [3] "MS, Subtype Not Specified"
table(zeno_pws_df$clean_sex)
## 
##     Female       Male Non-Binary 
##        162         53          2
zeno_pws_df$clean_sex <- factor(zeno_pws_df$clean_sex, 
                                           levels = c('Female', 
                                                      'Male',
                                                      'Non-Binary'), 
                                           ordered = FALSE)
print(levels(zeno_pws_df$clean_sex))
## [1] "Female"     "Male"       "Non-Binary"

Drop healthy controls - no EDSS and T25FW

zeno_pws_df <- zeno_pws_df[grepl('MS', zeno_pws_df$demographic_diagnosis), ]
table(zeno_pws_df$demographic_diagnosis)
## 
##  MS 
## 217
# convert infinite values to NA 
zeno_pws_df[] <- lapply(zeno_pws_df, function(x) {
  if (is.numeric(x)) replace(x, is.infinite(x), NA) else x
})
# filter to unique IDs - one row per person, select first video 
nrow(zeno_pws_df)
## [1] 217
zeno_pws_uniqueid_df <- zeno_pws_df %>%
  arrange(visit_date_video) %>%   # Sort by date
  distinct(bw_id, .keep_all = TRUE)  # Keep the first occurrence of each ID

nrow(zeno_pws_uniqueid_df)
## [1] 152

Missing Data

# count number of missing variables in preferred walking speed data frame 
sum(is.na(zeno_pws_df$delta_pix_h_rel_median_pose_zv))
## [1] 14
sum(is.na(zeno_pws_df$stride_time_mean_sec_pose_zv))
## [1] 48
sum(is.na(zeno_pws_df$mean_cadence_step_per_min_pose_zv))
## [1] 40
sum(is.na(zeno_pws_df$stride_width_mean_cm_pose_zv))
## [1] 40
# stance and all double support measures 
sum(is.na(zeno_pws_df$foot1_gait_cycle_time_mean_pose_zv))
## [1] 159
# ground truth preferred walk zeno mat data 
sum(is.na(zeno_pws_df$PWS_cadencestepsminmean))
## [1] 0
sum(is.na(zeno_pws_df$bingoEHR_EDSS_measure_value))
## [1] 0
sum(is.na(zeno_pws_df$msfcEHR_T25FW.SPEED.AVG))
## [1] 0
# demographics 
sum(is.na(zeno_pws_df$demoEHR_Age))
## [1] 0
sum(is.na(zeno_pws_df$demoEHR_DiseaseDuration)) 
## [1] 0
sum(is.na(zeno_pws_df$ms_dx_condensed))
## [1] 0
sum(is.na(zeno_pws_df$clean_ethnicity))
## [1] 0
sum(is.na(zeno_pws_df$clean_sex))
## [1] 0
sum(is.na(zeno_pws_df$ms_dx_condensed))
## [1] 0

Fast walking speed videos

zeno_fw_df <- read.csv("C:/Users/mmccu/Box/MM_Personal/5_Projects/BoveLab/3_Data_and_Code/gait_bw_zeno_home_analysis/004/000_merged_cleaned_data/zv_bw_merged_gait_vertical_FW_1_clean.csv")
table(zeno_fw_df$task_pose)
## 
## gait_vertical_FW_1 
##                218
# assign levels to categorical variables 
table(zeno_fw_df$race_ethnicity_clean)
## 
##                     Asian Black Or African American        Hispanic or Latino 
##                        17                        14                        20 
##    Other/Unknown/Declined        White Not Hispanic 
##                        18                       149
zeno_fw_df$race_ethnicity_clean <- factor(zeno_fw_df$race_ethnicity_clean, 
                                           levels = c('Asian', 
                                                      'Black Or African American',
                                                      'Hispanic or Latino',
                                                      'White Not Hispanic',
                                                      'Other/Unknown/Declined'), 
                                           ordered = FALSE)
print(levels(zeno_fw_df$race_ethnicity_clean))
## [1] "Asian"                     "Black Or African American"
## [3] "Hispanic or Latino"        "White Not Hispanic"       
## [5] "Other/Unknown/Declined"
table(zeno_fw_df$ms_dx_condensed)
## 
## MS, Subtype Not Specified            Progressive MS                      RRMS 
##                         2                        37                       179
zeno_fw_df$ms_dx_condensed <- factor(zeno_fw_df$ms_dx_condensed, 
                                           levels = c('RRMS', 
                                                      'Progressive MS',
                                                      'MS, Subtype Not Specified'), 
                                           ordered = FALSE)
print(levels(zeno_fw_df$ms_dx_condensed))
## [1] "RRMS"                      "Progressive MS"           
## [3] "MS, Subtype Not Specified"
table(zeno_fw_df$clean_sex)
## 
##     Female       Male Non-Binary 
##        163         53          2
zeno_fw_df$clean_sex <- factor(zeno_fw_df$clean_sex, 
                                           levels = c('Female', 
                                                      'Male',
                                                      'Non-Binary'), 
                                           ordered = FALSE)
print(levels(zeno_fw_df$clean_sex))
## [1] "Female"     "Male"       "Non-Binary"
zeno_fw_df <- zeno_fw_df[grepl('MS', zeno_fw_df$demographic_diagnosis), ]
table(zeno_fw_df$demographic_diagnosis)
## 
##  MS 
## 218
# convert infinite values to NA 
zeno_fw_df[] <- lapply(zeno_fw_df, function(x) {
  if (is.numeric(x)) replace(x, is.infinite(x), NA) else x
})
# filter to unique IDs - one row per person, select first video 
nrow(zeno_fw_df)
## [1] 218
zeno_fw_uniqueid_df <- zeno_fw_df %>%
  arrange(visit_date_video) %>%   # Sort by date
  distinct(bw_id, .keep_all = TRUE)  # Keep the first occurrence of each ID

nrow(zeno_fw_uniqueid_df)
## [1] 152
# count number of missing variables in fast walking speed data frame 
sum(is.na(zeno_fw_df$delta_pix_h_rel_median_pose_zv))
## [1] 3
sum(is.na(zeno_fw_df$stride_time_mean_sec_pose_zv))
## [1] 53
sum(is.na(zeno_fw_df$mean_cadence_step_per_min_pose_zv))
## [1] 46
sum(is.na(zeno_fw_df$stride_width_mean_cm_pose_zv))
## [1] 47
# stance and all double support measures 
sum(is.na(zeno_fw_df$foot1_gait_cycle_time_mean_pose_zv))
## [1] 186
# ground truth preferred walk zeno mat data 
sum(is.na(zeno_fw_df$PWS_cadencestepsminmean))
## [1] 0
sum(is.na(zeno_fw_df$bingoEHR_EDSS_measure_value))
## [1] 0
sum(is.na(zeno_fw_df$msfcEHR_T25FW.SPEED.AVG))
## [1] 0
# demographics 
sum(is.na(zeno_fw_df$demoEHR_Age))
## [1] 0
sum(is.na(zeno_fw_df$demoEHR_DiseaseDuration)) 
## [1] 0
sum(is.na(zeno_fw_df$race_ethnicity_clean))
## [1] 0
sum(is.na(zeno_fw_df$clean_sex))
## [1] 0
sum(is.na(zeno_fw_df$ms_dx_condensed))
## [1] 0

Load and format home video data

Some participants have videos from multiple timepoints (baseline and follow up) At each timepoint, participants sent back two videos - one turning to the right (gait_vertical_right task) and one turning to the left (gait_vertical_left task)

home_df <- read.csv("C:/Users/mmccu/Box/MM_Personal/5_Projects/BoveLab/3_Data_and_Code/gait_bw_zeno_home_analysis/004/000_merged_cleaned_data/hv_bw_merged_clean.csv")
nrow(home_df)
## [1] 63
table(home_df$demographic_diagnosis)
## 
## MS 
## 63
table(home_df$task_pose_hv)
## 
##  gait_vertical_left gait_vertical_right 
##                  31                  32
# assign levels to categorical variables 
table(home_df$race_ethnicity_clean)
## 
##                     Asian Black Or African American        Hispanic or Latino 
##                         4                         2                         2 
##    Other/Unknown/Declined        White Not Hispanic 
##                         9                        46
home_df$race_ethnicity_clean <- factor(home_df$race_ethnicity_clean, 
                                           levels = c('Asian', 
                                                      'Black Or African American',
                                                      'Hispanic or Latino',
                                                      'White Not Hispanic',
                                                      'Other/Unknown/Declined'), 
                                           ordered = FALSE)
print(levels(home_df$race_ethnicity_clean))
## [1] "Asian"                     "Black Or African American"
## [3] "Hispanic or Latino"        "White Not Hispanic"       
## [5] "Other/Unknown/Declined"
table(home_df$ms_dx_condensed)
## 
## MS, Subtype Not Specified            Progressive MS                      RRMS 
##                         4                         7                        52
home_df$ms_dx_condensed <- factor(home_df$ms_dx_condensed, 
                                           levels = c('RRMS', 
                                                      'Progressive MS',
                                                      'MS, Subtype Not Specified'), 
                                           ordered = FALSE)
print(levels(home_df$ms_dx_condensed))
## [1] "RRMS"                      "Progressive MS"           
## [3] "MS, Subtype Not Specified"
table(home_df$clean_sex)
## 
##     Female       Male Non-Binary 
##         52          9          2
home_df$clean_sex <- factor(home_df$clean_sex, 
                                           levels = c('Female', 
                                                      'Male',
                                                      'Non-Binary'), 
                                           ordered = FALSE)
print(levels(home_df$clean_sex))
## [1] "Female"     "Male"       "Non-Binary"
# convert infinite values to NA 
home_df[] <- lapply(home_df, function(x) {
  if (is.numeric(x)) replace(x, is.infinite(x), NA) else x
})

Group by left and right turning videos, unique IDs

# right turning videos  
home_r_df <- home_df[grepl('gait_vertical_right', home_df$task_pose_hv), ]
nrow(home_r_df)
## [1] 32
table(home_r_df$task_pose_hv)
## 
## gait_vertical_right 
##                  32
# left turning videos 
home_l_df <- home_df[grepl('gait_vertical_left', home_df$task_pose_hv), ]
nrow(home_l_df)
## [1] 31
table(home_l_df$task_pose_hv)
## 
## gait_vertical_left 
##                 31
# filter to unique IDs - one row per person, select first video 
home_uniqueid_df <- home_df %>%
  arrange(visit_date_video) %>%   # Sort by date
  distinct(bw_id, .keep_all = TRUE)  # Keep the first occurrence of each ID

nrow(home_uniqueid_df)
## [1] 30
# count number of missing variables in home video data frame 
sum(is.na(home_df$delta_pix_h_rel_median_pose_hv))
## [1] 4
sum(is.na(home_df$stride_time_mean_sec_pose_hv))
## [1] 13
sum(is.na(home_df$mean_cadence_step_per_min_pose_hv))
## [1] 12
sum(is.na(home_df$stride_width_mean_cm_pose_hv))
## [1] 12
# stance and all double support measures 
sum(is.na(home_df$foot1_gait_cycle_time_mean_pose_hv))
## [1] 32
# ground truth preferred walk zeno mat data 
sum(is.na(home_df$PWS_cadencestepsminmean))
## [1] 0
sum(is.na(home_df$bingoEHR_EDSS_measure_value))
## [1] 0
sum(is.na(home_df$msfcEHR_T25FW.SPEED.AVG))
## [1] 0
# demographics 
sum(is.na(home_df$demoEHR_Age))
## [1] 0
sum(is.na(home_df$demoEHR_DiseaseDuration)) 
## [1] 0
sum(is.na(home_df$race_ethnicity_clean))
## [1] 0
sum(is.na(home_df$clean_sex))
## [1] 0
sum(is.na(home_df$ms_dx_condensed))
## [1] 0

Function - Linear Regression Models

metric_regression <- function(data_frame, outcome, predictor) {
  
  outcome_string <- deparse(substitute(outcome))
  predictor_string <- deparse(substitute(predictor))
  data_frame_string <- deparse(substitute(data_frame))
  print(paste('Data Frame: ',  data_frame_string))
  
  # plot 
  print(ggplot(data = data_frame, aes_string(x = predictor_string, 
                                             y = outcome_string,
                                             color = "demoEHR_Age", 
                                             shape = "ms_dx_condensed")) + geom_point())
  
  
  # univariate model - just metric and outcome 
  outcome_predictor_string <- paste(outcome_string, "~", predictor_string, collapse = " ")
  print(outcome_predictor_string)
  
  model_1 <- lm(as.formula(outcome_predictor_string),
                data = data_frame)

  print(summary(model_1))
  hist(resid(model_1))


  # confounding: model + disease info and demographics
  additional_vars <- "demoEHR_Age + demoEHR_DiseaseDuration + 
                      ms_dx_condensed + 
                      race_ethnicity_clean + 
                      clean_sex"
  
  full_formula_string = paste(outcome_predictor_string, "+", additional_vars,  collapse = " ")
  print(full_formula_string)
  
  model_2 <- lm(as.formula(full_formula_string),
                data = data_frame)
  
  print(summary(model_2))
  hist(resid(model_2))
}

Linear Regression - T25FW

Transform T25FW

PWS, FW, and Home Videos

# preferred walking speed videos 
zeno_pws_df$t25fw_log <- log(zeno_pws_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = zeno_pws_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = zeno_pws_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# unique IDS 
zeno_pws_uniqueid_df$t25fw_log <- log(zeno_pws_uniqueid_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = zeno_pws_uniqueid_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = zeno_pws_uniqueid_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# fast walking speed videos 
zeno_fw_df$t25fw_log <- log(zeno_fw_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = zeno_fw_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = zeno_fw_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# unique IDs 
zeno_fw_uniqueid_df$t25fw_log <- log(zeno_fw_uniqueid_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = zeno_fw_uniqueid_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = zeno_fw_uniqueid_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# home - all videos  

home_df$t25fw_log <- log(home_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = home_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = home_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# home - right 
home_r_df$t25fw_log <- log(home_r_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = home_r_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = home_r_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# home - left
home_l_df$t25fw_log <- log(home_l_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = home_l_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = home_l_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# home - unique 
home_uniqueid_df$t25fw_log <- log(home_uniqueid_df$msfcEHR_T25FW.SPEED.AVG)

ggplot(data = home_uniqueid_df, mapping = aes(msfcEHR_T25FW.SPEED.AVG)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = home_uniqueid_df, mapping = aes(t25fw_log)) + 
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Preferred Walking Speed –> T25FW

PWS Demographics and Disease Info –> Log T25FW

# Preferred walking speed participants 

# model 
pws_dem_model <- lm(t25fw_log ~ demoEHR_Age +
                      demoEHR_DiseaseDuration +
                      ms_dx_condensed +
                      race_ethnicity_clean +
                      clean_sex,
                    data = zeno_pws_df)

summary(pws_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + race_ethnicity_clean + clean_sex, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.05263 -0.21089 -0.05063  0.13211  1.78009 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.343709   0.140298   9.578
## demoEHR_Age                                    0.007483   0.002850   2.626
## demoEHR_DiseaseDuration                       -0.004477   0.003750  -1.194
## ms_dx_condensedProgressive MS                  0.468407   0.077454   6.048
## ms_dx_condensedMS, Subtype Not Specified      -0.029325   0.278886  -0.105
## race_ethnicity_cleanBlack Or African American  0.182299   0.142230   1.282
## race_ethnicity_cleanHispanic or Latino        -0.060882   0.128107  -0.475
## race_ethnicity_cleanWhite Not Hispanic        -0.159167   0.104390  -1.525
## race_ethnicity_cleanOther/Unknown/Declined    -0.087477   0.131936  -0.663
## clean_sexMale                                 -0.050412   0.063415  -0.795
## clean_sexNon-Binary                            0.007581   0.276860   0.027
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## demoEHR_Age                                    0.00929 ** 
## demoEHR_DiseaseDuration                        0.23383    
## ms_dx_condensedProgressive MS                 6.82e-09 ***
## ms_dx_condensedMS, Subtype Not Specified       0.91636    
## race_ethnicity_cleanBlack Or African American  0.20138    
## race_ethnicity_cleanHispanic or Latino         0.63512    
## race_ethnicity_cleanWhite Not Hispanic         0.12886    
## race_ethnicity_cleanOther/Unknown/Declined     0.50805    
## clean_sexMale                                  0.42756    
## clean_sexNon-Binary                            0.97818    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3848 on 206 degrees of freedom
## Multiple R-squared:  0.2792, Adjusted R-squared:  0.2442 
## F-statistic:  7.98 on 10 and 206 DF,  p-value: 7.833e-11
hist(resid(pws_dem_model))

# model - unique IDS 
pws_dem_model_2 <- lm(t25fw_log ~ demoEHR_Age +
                      demoEHR_DiseaseDuration +
                      ms_dx_condensed +
                      race_ethnicity_clean +
                      clean_sex,
                    data = zeno_pws_uniqueid_df)

summary(pws_dem_model_2)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + race_ethnicity_clean + clean_sex, data = zeno_pws_uniqueid_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.92748 -0.18385 -0.04131  0.10597  1.55919 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.404395   0.163024   8.615
## demoEHR_Age                                    0.006096   0.003078   1.980
## demoEHR_DiseaseDuration                       -0.002272   0.004540  -0.500
## ms_dx_condensedProgressive MS                  0.491164   0.086659   5.668
## ms_dx_condensedMS, Subtype Not Specified      -0.033748   0.273835  -0.123
## race_ethnicity_cleanBlack Or African American  0.054728   0.162035   0.338
## race_ethnicity_cleanHispanic or Latino        -0.036624   0.149956  -0.244
## race_ethnicity_cleanWhite Not Hispanic        -0.175147   0.123557  -1.418
## race_ethnicity_cleanOther/Unknown/Declined    -0.078325   0.158644  -0.494
## clean_sexMale                                 -0.023110   0.072929  -0.317
## clean_sexNon-Binary                           -0.005586   0.380029  -0.015
##                                               Pr(>|t|)    
## (Intercept)                                   1.27e-14 ***
## demoEHR_Age                                     0.0496 *  
## demoEHR_DiseaseDuration                         0.6176    
## ms_dx_condensedProgressive MS                 7.86e-08 ***
## ms_dx_condensedMS, Subtype Not Specified        0.9021    
## race_ethnicity_cleanBlack Or African American   0.7361    
## race_ethnicity_cleanHispanic or Latino          0.8074    
## race_ethnicity_cleanWhite Not Hispanic          0.1585    
## race_ethnicity_cleanOther/Unknown/Declined      0.6223    
## clean_sexMale                                   0.7518    
## clean_sexNon-Binary                             0.9883    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3752 on 141 degrees of freedom
## Multiple R-squared:  0.2885, Adjusted R-squared:  0.238 
## F-statistic: 5.717 on 10 and 141 DF,  p-value: 3.586e-07
hist(resid(pws_dem_model_2))

Univariate - PWS, delta pixel proxy –> T25fw

# Preferred Walking Speed 
sum(is.finite(zeno_pws_df$delta_pix_h_rel_median_pose_zv))
## [1] 203
zeno_pws_df$log_delta_pix_h_rel_median_pose_zv <- log(zeno_pws_df$delta_pix_h_rel_median_pose_zv)
zeno_pws_df$sqrt_delta_pix_h_rel_median_pose_zv <- sqrt(zeno_pws_df$delta_pix_h_rel_median_pose_zv)

# log velproxy and log t25Fw
metric_regression(zeno_pws_df, t25fw_log, log_delta_pix_h_rel_median_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## i Please use tidy evaluation idioms with `aes()`.
## i See also `vignette("ggplot2-in-packages")` for more information.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 14 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.17314 -0.20739 -0.02811  0.17522  1.48275 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         0.90555    0.07602   11.91   <2e-16 ***
## log_delta_pix_h_rel_median_pose_zv -0.51691    0.05066  -10.20   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3689 on 201 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.3412, Adjusted R-squared:  0.338 
## F-statistic: 104.1 on 1 and 201 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.94418 -0.17936 -0.02638  0.15895  1.22540 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.651281   0.149829   4.347
## log_delta_pix_h_rel_median_pose_zv            -0.416540   0.051460  -8.094
## demoEHR_Age                                    0.008772   0.002503   3.505
## demoEHR_DiseaseDuration                       -0.003550   0.003309  -1.073
## ms_dx_condensedProgressive MS                  0.256603   0.076814   3.341
## ms_dx_condensedMS, Subtype Not Specified       0.022346   0.242698   0.092
## race_ethnicity_cleanBlack Or African American  0.254830   0.127236   2.003
## race_ethnicity_cleanHispanic or Latino         0.058290   0.118137   0.493
## race_ethnicity_cleanWhite Not Hispanic        -0.096629   0.095827  -1.008
## race_ethnicity_cleanOther/Unknown/Declined    -0.015309   0.120027  -0.128
## clean_sexMale                                 -0.024896   0.057579  -0.432
## clean_sexNon-Binary                            0.120376   0.338105   0.356
##                                               Pr(>|t|)    
## (Intercept)                                   2.24e-05 ***
## log_delta_pix_h_rel_median_pose_zv            6.59e-14 ***
## demoEHR_Age                                    0.00057 ***
## demoEHR_DiseaseDuration                        0.28462    
## ms_dx_condensedProgressive MS                  0.00101 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.92673    
## race_ethnicity_cleanBlack Or African American  0.04661 *  
## race_ethnicity_cleanHispanic or Latino         0.62229    
## race_ethnicity_cleanWhite Not Hispanic         0.31455    
## race_ethnicity_cleanOther/Unknown/Declined     0.89864    
## clean_sexMale                                  0.66596    
## clean_sexNon-Binary                            0.72221    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3346 on 191 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.4851, Adjusted R-squared:  0.4554 
## F-statistic: 16.36 on 11 and 191 DF,  p-value: < 2.2e-16

# Benchmark - True PWS mat velocity and log25fw 
metric_regression(zeno_pws_df, t25fw_log, PWS_velocitycmsecmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ PWS_velocitycmsecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68111 -0.18501  0.00107  0.17512  1.27235 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            2.7684605  0.0723392   38.27   <2e-16 ***
## PWS_velocitycmsecmean -0.0109993  0.0006715  -16.38   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2959 on 215 degrees of freedom
## Multiple R-squared:  0.5551, Adjusted R-squared:  0.5531 
## F-statistic: 268.3 on 1 and 215 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ PWS_velocitycmsecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.59572 -0.15358 -0.01625  0.16525  1.16504 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    2.5211704  0.1361926  18.512
## PWS_velocitycmsecmean                         -0.0097653  0.0007369 -13.252
## demoEHR_Age                                    0.0064232  0.0020981   3.061
## demoEHR_DiseaseDuration                       -0.0041353  0.0027587  -1.499
## ms_dx_condensedProgressive MS                  0.1403804  0.0621267   2.260
## ms_dx_condensedMS, Subtype Not Specified       0.1097673  0.2054417   0.534
## race_ethnicity_cleanBlack Or African American -0.0781671  0.1064672  -0.734
## race_ethnicity_cleanHispanic or Latino        -0.1197515  0.0943516  -1.269
## race_ethnicity_cleanWhite Not Hispanic        -0.2099054  0.0768939  -2.730
## race_ethnicity_cleanOther/Unknown/Declined    -0.1491848  0.0971753  -1.535
## clean_sexMale                                 -0.0574213  0.0466571  -1.231
## clean_sexNon-Binary                            0.0960789  0.2037927   0.471
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## PWS_velocitycmsecmean                          < 2e-16 ***
## demoEHR_Age                                    0.00250 ** 
## demoEHR_DiseaseDuration                        0.13542    
## ms_dx_condensedProgressive MS                  0.02490 *  
## ms_dx_condensedMS, Subtype Not Specified       0.59371    
## race_ethnicity_cleanBlack Or African American  0.46367    
## race_ethnicity_cleanHispanic or Latino         0.20581    
## race_ethnicity_cleanWhite Not Hispanic         0.00689 ** 
## race_ethnicity_cleanOther/Unknown/Declined     0.12627    
## clean_sexMale                                  0.21984    
## clean_sexNon-Binary                            0.63782    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2831 on 205 degrees of freedom
## Multiple R-squared:  0.6118, Adjusted R-squared:  0.591 
## F-statistic: 29.37 on 11 and 205 DF,  p-value: < 2.2e-16

# unique IDs 
zeno_pws_uniqueid_df$log_delta_pix_h_rel_median_pose_zv <- log(zeno_pws_uniqueid_df$delta_pix_h_rel_median_pose_zv)

metric_regression(zeno_pws_uniqueid_df, t25fw_log, log_delta_pix_h_rel_median_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.95970 -0.18760 -0.04187  0.16277  1.39322 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         0.86851    0.08069   10.76   <2e-16 ***
## log_delta_pix_h_rel_median_pose_zv -0.56702    0.05558  -10.20   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3313 on 150 degrees of freedom
## Multiple R-squared:  0.4096, Adjusted R-squared:  0.4057 
## F-statistic: 104.1 on 1 and 150 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.77069 -0.16971 -0.03483  0.12025  1.16477 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.752857   0.156198   4.820
## log_delta_pix_h_rel_median_pose_zv            -0.492004   0.060006  -8.199
## demoEHR_Age                                    0.007514   0.002545   2.952
## demoEHR_DiseaseDuration                       -0.004691   0.003757  -1.249
## ms_dx_condensedProgressive MS                  0.180178   0.080922   2.227
## ms_dx_condensedMS, Subtype Not Specified       0.036349   0.226041   0.161
## race_ethnicity_cleanBlack Or African American  0.075771   0.133683   0.567
## race_ethnicity_cleanHispanic or Latino        -0.019307   0.123712  -0.156
## race_ethnicity_cleanWhite Not Hispanic        -0.200893   0.101967  -1.970
## race_ethnicity_cleanOther/Unknown/Declined    -0.168479   0.131322  -1.283
## clean_sexMale                                 -0.003996   0.060202  -0.066
## clean_sexNon-Binary                            0.103824   0.313759   0.331
##                                               Pr(>|t|)    
## (Intercept)                                   3.69e-06 ***
## log_delta_pix_h_rel_median_pose_zv            1.39e-13 ***
## demoEHR_Age                                     0.0037 ** 
## demoEHR_DiseaseDuration                         0.2139    
## ms_dx_condensedProgressive MS                   0.0276 *  
## ms_dx_condensedMS, Subtype Not Specified        0.8725    
## race_ethnicity_cleanBlack Or African American   0.5718    
## race_ethnicity_cleanHispanic or Latino          0.8762    
## race_ethnicity_cleanWhite Not Hispanic          0.0508 .  
## race_ethnicity_cleanOther/Unknown/Declined      0.2016    
## clean_sexMale                                   0.9472    
## clean_sexNon-Binary                             0.7412    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3095 on 140 degrees of freedom
## Multiple R-squared:  0.5193, Adjusted R-squared:  0.4815 
## F-statistic: 13.75 on 11 and 140 DF,  p-value: < 2.2e-16

Univariate - PWS, stride time –> T25fw

# Preferred Walking speed 
sum(is.finite(zeno_pws_df$stride_time_mean_sec_pose_zv))
## [1] 169
# stride time mean 
ggplot(data = zeno_pws_df, aes(x = stride_time_mean_sec_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 48 rows containing missing values (`geom_point()`).

# stride time median 
ggplot(data = zeno_pws_df, aes(x = stride_time_median_sec_pose_zv, y = t25fw_log)) +
  geom_point()
## Warning: Removed 48 rows containing missing values (`geom_point()`).

# stride time max 
ggplot(data = zeno_pws_df, aes(x = stride_time_max_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 48 rows containing missing values (`geom_point()`).

# stride time min 
ggplot(data = zeno_pws_df, aes(x = stride_time_min_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 48 rows containing missing values (`geom_point()`).

# stride time std 
ggplot(data = zeno_pws_df, aes(x = stride_time_std_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 53 rows containing missing values (`geom_point()`).

# stride time cv 
ggplot(data = zeno_pws_df, aes(x = stride_time_cv_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 53 rows containing missing values (`geom_point()`).

# Selected median, seemed most linear 
metric_regression(zeno_pws_df, t25fw_log, stride_time_median_sec_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 48 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.76611 -0.20721 -0.07297  0.16050  1.24166 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.5683     0.1934   2.939  0.00376 ** 
## stride_time_median_sec_pose_zv   0.9197     0.1707   5.388 2.39e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3274 on 167 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.1481, Adjusted R-squared:  0.143 
## F-statistic: 29.03 on 1 and 167 DF,  p-value: 2.39e-07

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.59735 -0.19259 -0.06107  0.12804  1.20275 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.546523   0.225362   2.425
## stride_time_median_sec_pose_zv                 0.781865   0.162184   4.821
## demoEHR_Age                                    0.005610   0.002506   2.238
## demoEHR_DiseaseDuration                        0.003138   0.003365   0.933
## ms_dx_condensedProgressive MS                  0.193693   0.073630   2.631
## ms_dx_condensedMS, Subtype Not Specified      -0.036535   0.213422  -0.171
## race_ethnicity_cleanBlack Or African American  0.248300   0.122594   2.025
## race_ethnicity_cleanHispanic or Latino        -0.187214   0.111049  -1.686
## race_ethnicity_cleanWhite Not Hispanic        -0.196061   0.093206  -2.104
## race_ethnicity_cleanOther/Unknown/Declined    -0.081488   0.130867  -0.623
## clean_sexMale                                 -0.057530   0.053015  -1.085
## clean_sexNon-Binary                            0.048819   0.296606   0.165
##                                               Pr(>|t|)    
## (Intercept)                                    0.01644 *  
## stride_time_median_sec_pose_zv                3.35e-06 ***
## demoEHR_Age                                    0.02660 *  
## demoEHR_DiseaseDuration                        0.35247    
## ms_dx_condensedProgressive MS                  0.00937 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.86430    
## race_ethnicity_cleanBlack Or African American  0.04452 *  
## race_ethnicity_cleanHispanic or Latino         0.09381 .  
## race_ethnicity_cleanWhite Not Hispanic         0.03701 *  
## race_ethnicity_cleanOther/Unknown/Declined     0.53440    
## clean_sexMale                                  0.27951    
## clean_sexNon-Binary                            0.86948    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2933 on 157 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.3574, Adjusted R-squared:  0.3124 
## F-statistic: 7.939 on 11 and 157 DF,  p-value: 6.801e-11

# benchmark - true PWS stride time 
metric_regression(zeno_pws_df, t25fw_log, PWS_stridetimesecmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ PWS_stridetimesecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.72699 -0.18864 -0.01653  0.13678  1.39715 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            0.44946    0.07601   5.913 1.31e-08 ***
## PWS_stridetimesecmean  0.96084    0.05961  16.117  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2985 on 215 degrees of freedom
## Multiple R-squared:  0.5472, Adjusted R-squared:  0.545 
## F-statistic: 259.8 on 1 and 215 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ PWS_stridetimesecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.59456 -0.17436 -0.03791  0.13411  1.36432 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.367559   0.119960   3.064
## PWS_stridetimesecmean                          0.877540   0.060819  14.429
## demoEHR_Age                                    0.006747   0.002013   3.352
## demoEHR_DiseaseDuration                        0.002570   0.002692   0.955
## ms_dx_condensedProgressive MS                  0.136581   0.059328   2.302
## ms_dx_condensedMS, Subtype Not Specified      -0.009244   0.196923  -0.047
## race_ethnicity_cleanBlack Or African American  0.029873   0.100981   0.296
## race_ethnicity_cleanHispanic or Latino        -0.207634   0.091025  -2.281
## race_ethnicity_cleanWhite Not Hispanic        -0.237048   0.073906  -3.207
## race_ethnicity_cleanOther/Unknown/Declined    -0.144949   0.093243  -1.555
## clean_sexMale                                 -0.038496   0.044785  -0.860
## clean_sexNon-Binary                            0.126224   0.195661   0.645
##                                               Pr(>|t|)    
## (Intercept)                                   0.002477 ** 
## PWS_stridetimesecmean                          < 2e-16 ***
## demoEHR_Age                                   0.000955 ***
## demoEHR_DiseaseDuration                       0.340867    
## ms_dx_condensedProgressive MS                 0.022332 *  
## ms_dx_condensedMS, Subtype Not Specified      0.962605    
## race_ethnicity_cleanBlack Or African American 0.767659    
## race_ethnicity_cleanHispanic or Latino        0.023572 *  
## race_ethnicity_cleanWhite Not Hispanic        0.001554 ** 
## race_ethnicity_cleanOther/Unknown/Declined    0.121602    
## clean_sexMale                                 0.391026    
## clean_sexNon-Binary                           0.519573    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2717 on 205 degrees of freedom
## Multiple R-squared:  0.6424, Adjusted R-squared:  0.6232 
## F-statistic: 33.48 on 11 and 205 DF,  p-value: < 2.2e-16

# video unique IDs
metric_regression(zeno_pws_uniqueid_df, t25fw_log, stride_time_median_sec_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 37 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.48517 -0.23439 -0.05909  0.14529  1.13224 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.7273     0.2230   3.262 0.001465 ** 
## stride_time_median_sec_pose_zv   0.7893     0.1968   4.011 0.000109 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3269 on 113 degrees of freedom
##   (37 observations deleted due to missingness)
## Multiple R-squared:  0.1246, Adjusted R-squared:  0.1169 
## F-statistic: 16.09 on 1 and 113 DF,  p-value: 0.0001089

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.49847 -0.19754 -0.06398  0.15701  1.07644 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.879402   0.280378   3.136
## stride_time_median_sec_pose_zv                 0.582500   0.188486   3.090
## demoEHR_Age                                    0.004579   0.002834   1.616
## demoEHR_DiseaseDuration                        0.003125   0.004120   0.758
## ms_dx_condensedProgressive MS                  0.263836   0.087106   3.029
## ms_dx_condensedMS, Subtype Not Specified      -0.032504   0.218140  -0.149
## race_ethnicity_cleanBlack Or African American  0.126946   0.157660   0.805
## race_ethnicity_cleanHispanic or Latino        -0.226582   0.149075  -1.520
## race_ethnicity_cleanWhite Not Hispanic        -0.251659   0.128450  -1.959
## race_ethnicity_cleanOther/Unknown/Declined    -0.183476   0.167339  -1.096
## clean_sexMale                                 -0.055093   0.064653  -0.852
## clean_sexNon-Binary                            0.034862   0.301936   0.115
##                                               Pr(>|t|)   
## (Intercept)                                    0.00223 **
## stride_time_median_sec_pose_zv                 0.00257 **
## demoEHR_Age                                    0.10921   
## demoEHR_DiseaseDuration                        0.44998   
## ms_dx_condensedProgressive MS                  0.00310 **
## ms_dx_condensedMS, Subtype Not Specified       0.88184   
## race_ethnicity_cleanBlack Or African American  0.42257   
## race_ethnicity_cleanHispanic or Latino         0.13159   
## race_ethnicity_cleanWhite Not Hispanic         0.05279 . 
## race_ethnicity_cleanOther/Unknown/Declined     0.27545   
## clean_sexMale                                  0.39612   
## clean_sexNon-Binary                            0.90830   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2972 on 103 degrees of freedom
##   (37 observations deleted due to missingness)
## Multiple R-squared:  0.3405, Adjusted R-squared:  0.2701 
## F-statistic: 4.835 on 11 and 103 DF,  p-value: 5.552e-06

Univariate - PWS, Cadence –> T25fw

# PWS 
sum(is.finite(zeno_pws_df$mean_cadence_step_per_min_pose_zv))
## [1] 177
# cadence model 
metric_regression(zeno_pws_df, t25fw_log, mean_cadence_step_per_min_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 40 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.79691 -0.22803 -0.05002  0.13301  1.85437 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.628380   0.194369  13.523  < 2e-16 ***
## mean_cadence_step_per_min_pose_zv -0.009757   0.001859  -5.249 4.39e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3677 on 175 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.136,  Adjusted R-squared:  0.1311 
## F-statistic: 27.55 on 1 and 175 DF,  p-value: 4.388e-07

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.58271 -0.18362 -0.03909  0.13333  1.42880 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    2.296e+00  2.286e-01  10.044
## mean_cadence_step_per_min_pose_zv             -8.501e-03  1.740e-03  -4.886
## demoEHR_Age                                    7.304e-03  2.658e-03   2.748
## demoEHR_DiseaseDuration                       -3.152e-05  3.539e-03  -0.009
## ms_dx_condensedProgressive MS                  2.910e-01  7.578e-02   3.840
## ms_dx_condensedMS, Subtype Not Specified       2.094e-02  2.327e-01   0.090
## race_ethnicity_cleanBlack Or African American  2.452e-01  1.332e-01   1.841
## race_ethnicity_cleanHispanic or Latino        -1.018e-01  1.197e-01  -0.850
## race_ethnicity_cleanWhite Not Hispanic        -2.432e-01  1.013e-01  -2.402
## race_ethnicity_cleanOther/Unknown/Declined    -1.798e-01  1.411e-01  -1.274
## clean_sexMale                                 -1.155e-01  5.709e-02  -2.023
## clean_sexNon-Binary                            7.016e-02  3.233e-01   0.217
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## mean_cadence_step_per_min_pose_zv             2.42e-06 ***
## demoEHR_Age                                   0.006658 ** 
## demoEHR_DiseaseDuration                       0.992904    
## ms_dx_condensedProgressive MS                 0.000175 ***
## ms_dx_condensedMS, Subtype Not Specified      0.928390    
## race_ethnicity_cleanBlack Or African American 0.067365 .  
## race_ethnicity_cleanHispanic or Latino        0.396462    
## race_ethnicity_cleanWhite Not Hispanic        0.017419 *  
## race_ethnicity_cleanOther/Unknown/Declined    0.204411    
## clean_sexMale                                 0.044684 *  
## clean_sexNon-Binary                           0.828475    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3196 on 165 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.3846, Adjusted R-squared:  0.3436 
## F-statistic: 9.375 on 11 and 165 DF,  p-value: 5.554e-13

# ground truth cadence from mat 
metric_regression(zeno_pws_df, t25fw_log, PWS_cadencestepsminmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ PWS_cadencestepsminmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.78923 -0.19583 -0.02581  0.18096  1.27164 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              3.482224   0.138322   25.18   <2e-16 ***
## PWS_cadencestepsminmean -0.018329   0.001351  -13.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3256 on 215 degrees of freedom
## Multiple R-squared:  0.4611, Adjusted R-squared:  0.4586 
## F-statistic:   184 on 1 and 215 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ PWS_cadencestepsminmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5824 -0.1870 -0.0275  0.1530  1.2647 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    3.108222   0.176990  17.562
## PWS_cadencestepsminmean                       -0.016898   0.001357 -12.456
## demoEHR_Age                                    0.008182   0.002156   3.795
## demoEHR_DiseaseDuration                        0.002822   0.002896   0.975
## ms_dx_condensedProgressive MS                  0.162101   0.063530   2.552
## ms_dx_condensedMS, Subtype Not Specified       0.029441   0.210971   0.140
## race_ethnicity_cleanBlack Or African American -0.028201   0.108887  -0.259
## race_ethnicity_cleanHispanic or Latino        -0.157025   0.097193  -1.616
## race_ethnicity_cleanWhite Not Hispanic        -0.264972   0.079405  -3.337
## race_ethnicity_cleanOther/Unknown/Declined    -0.164333   0.099972  -1.644
## clean_sexMale                                 -0.094579   0.048091  -1.967
## clean_sexNon-Binary                            0.144435   0.209675   0.689
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## PWS_cadencestepsminmean                        < 2e-16 ***
## demoEHR_Age                                   0.000194 ***
## demoEHR_DiseaseDuration                       0.330926    
## ms_dx_condensedProgressive MS                 0.011453 *  
## ms_dx_condensedMS, Subtype Not Specified      0.889154    
## race_ethnicity_cleanBlack Or African American 0.795903    
## race_ethnicity_cleanHispanic or Latino        0.107720    
## race_ethnicity_cleanWhite Not Hispanic        0.001006 ** 
## race_ethnicity_cleanOther/Unknown/Declined    0.101752    
## clean_sexMale                                 0.050573 .  
## clean_sexNon-Binary                           0.491696    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.291 on 205 degrees of freedom
## Multiple R-squared:  0.5897, Adjusted R-squared:  0.5677 
## F-statistic: 26.79 on 11 and 205 DF,  p-value: < 2.2e-16

# unique ID 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, mean_cadence_step_per_min_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 29 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.65924 -0.24384 -0.07236  0.11962  1.88288 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.455456   0.234817  10.457  < 2e-16 ***
## mean_cadence_step_per_min_pose_zv -0.007971   0.002262  -3.524 0.000601 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3879 on 121 degrees of freedom
##   (29 observations deleted due to missingness)
## Multiple R-squared:  0.09307,    Adjusted R-squared:  0.08558 
## F-statistic: 12.42 on 1 and 121 DF,  p-value: 0.0006012

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.64415 -0.22443 -0.03427  0.11734  1.36220 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    2.1619560  0.2881680   7.502
## mean_cadence_step_per_min_pose_zv             -0.0063258  0.0020926  -3.023
## demoEHR_Age                                    0.0069087  0.0030653   2.254
## demoEHR_DiseaseDuration                       -0.0005588  0.0044213  -0.126
## ms_dx_condensedProgressive MS                  0.3840172  0.0911174   4.215
## ms_dx_condensedMS, Subtype Not Specified       0.0249596  0.2455790   0.102
## race_ethnicity_cleanBlack Or African American  0.1123807  0.1773471   0.634
## race_ethnicity_cleanHispanic or Latino        -0.1382831  0.1652262  -0.837
## race_ethnicity_cleanWhite Not Hispanic        -0.3253947  0.1441959  -2.257
## race_ethnicity_cleanOther/Unknown/Declined    -0.2666967  0.1862701  -1.432
## clean_sexMale                                 -0.1067168  0.0713328  -1.496
## clean_sexNon-Binary                            0.0603212  0.3398157   0.178
##                                               Pr(>|t|)    
## (Intercept)                                   1.66e-11 ***
## mean_cadence_step_per_min_pose_zv              0.00311 ** 
## demoEHR_Age                                    0.02617 *  
## demoEHR_DiseaseDuration                        0.89965    
## ms_dx_condensedProgressive MS                 5.12e-05 ***
## ms_dx_condensedMS, Subtype Not Specified       0.91923    
## race_ethnicity_cleanBlack Or African American  0.52760    
## race_ethnicity_cleanHispanic or Latino         0.40443    
## race_ethnicity_cleanWhite Not Hispanic         0.02599 *  
## race_ethnicity_cleanOther/Unknown/Declined     0.15502    
## clean_sexMale                                  0.13748    
## clean_sexNon-Binary                            0.85943    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3343 on 111 degrees of freedom
##   (29 observations deleted due to missingness)
## Multiple R-squared:  0.3819, Adjusted R-squared:  0.3207 
## F-statistic: 6.235 on 11 and 111 DF,  p-value: 6.376e-08

Univariate - PWS, Stride Width –> T25fw

sum(is.finite(zeno_pws_df$stride_width_mean_cm_pose_zv))
## [1] 177
# Preferred Walking Speed 
ggplot(data = zeno_pws_df, aes(x = stride_width_mean_cm_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_median_cm_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_min_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_max_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_std_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 42 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_cv_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 42 rows containing missing values (`geom_point()`).

## model  
metric_regression(zeno_pws_df, t25fw_log, stride_width_median_cm_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 40 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.69520 -0.22012 -0.06513  0.11031  2.28879 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                    1.183267   0.107949  10.961  < 2e-16 ***
## stride_width_median_cm_pose_zv 0.034898   0.008352   4.178 4.63e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3772 on 175 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.09072,    Adjusted R-squared:  0.08552 
## F-statistic: 17.46 on 1 and 175 DF,  p-value: 4.627e-05

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.66382 -0.20045 -0.05566  0.15620  1.71245 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.135503   0.175597   6.467
## stride_width_median_cm_pose_zv                 0.019155   0.008008   2.392
## demoEHR_Age                                    0.007323   0.002796   2.620
## demoEHR_DiseaseDuration                       -0.002412   0.003688  -0.654
## ms_dx_condensedProgressive MS                  0.337942   0.079970   4.226
## ms_dx_condensedMS, Subtype Not Specified      -0.060155   0.245001  -0.246
## race_ethnicity_cleanBlack Or African American  0.271156   0.139950   1.938
## race_ethnicity_cleanHispanic or Latino        -0.053535   0.127092  -0.421
## race_ethnicity_cleanWhite Not Hispanic        -0.188346   0.107019  -1.760
## race_ethnicity_cleanOther/Unknown/Declined    -0.011352   0.145930  -0.078
## clean_sexMale                                 -0.097167   0.059913  -1.622
## clean_sexNon-Binary                           -0.028108   0.339871  -0.083
##                                               Pr(>|t|)    
## (Intercept)                                   1.09e-09 ***
## stride_width_median_cm_pose_zv                 0.01789 *  
## demoEHR_Age                                    0.00962 ** 
## demoEHR_DiseaseDuration                        0.51396    
## ms_dx_condensedProgressive MS                 3.93e-05 ***
## ms_dx_condensedMS, Subtype Not Specified       0.80635    
## race_ethnicity_cleanBlack Or African American  0.05439 .  
## race_ethnicity_cleanHispanic or Latino         0.67413    
## race_ethnicity_cleanWhite Not Hispanic         0.08027 .  
## race_ethnicity_cleanOther/Unknown/Declined     0.93809    
## clean_sexMale                                  0.10675    
## clean_sexNon-Binary                            0.93419    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3361 on 165 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.3192, Adjusted R-squared:  0.2738 
## F-statistic: 7.032 on 11 and 165 DF,  p-value: 1.033e-09

## pressure mat stride width model
metric_regression(zeno_pws_df, t25fw_log, PWS_stridewidthcmmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ PWS_stridewidthcmmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61811 -0.22611 -0.09524  0.12265  2.08325 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.188185   0.072603  16.365  < 2e-16 ***
## PWS_stridewidthcmmean 0.045545   0.006925   6.577 3.59e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4048 on 215 degrees of freedom
## Multiple R-squared:  0.1675, Adjusted R-squared:  0.1636 
## F-statistic: 43.26 on 1 and 215 DF,  p-value: 3.592e-10

## [1] "t25fw_log ~ PWS_stridewidthcmmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.85936 -0.19830 -0.04167  0.12074  1.66149 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.943975   0.152398   6.194
## PWS_stridewidthcmmean                          0.035351   0.006730   5.253
## demoEHR_Age                                    0.007900   0.002683   2.944
## demoEHR_DiseaseDuration                       -0.005228   0.003532  -1.480
## ms_dx_condensedProgressive MS                  0.382962   0.074686   5.128
## ms_dx_condensedMS, Subtype Not Specified       0.119986   0.263996   0.454
## race_ethnicity_cleanBlack Or African American  0.129692   0.134228   0.966
## race_ethnicity_cleanHispanic or Latino        -0.010466   0.120944  -0.087
## race_ethnicity_cleanWhite Not Hispanic        -0.076788   0.099486  -0.772
## race_ethnicity_cleanOther/Unknown/Declined    -0.008564   0.125071  -0.068
## clean_sexMale                                 -0.082657   0.059996  -1.378
## clean_sexNon-Binary                            0.036218   0.260612   0.139
##                                               Pr(>|t|)    
## (Intercept)                                   3.15e-09 ***
## PWS_stridewidthcmmean                         3.75e-07 ***
## demoEHR_Age                                    0.00361 ** 
## demoEHR_DiseaseDuration                        0.14035    
## ms_dx_condensedProgressive MS                 6.77e-07 ***
## ms_dx_condensedMS, Subtype Not Specified       0.64995    
## race_ethnicity_cleanBlack Or African American  0.33508    
## race_ethnicity_cleanHispanic or Latino         0.93112    
## race_ethnicity_cleanWhite Not Hispanic         0.44110    
## race_ethnicity_cleanOther/Unknown/Declined     0.94547    
## clean_sexMale                                  0.16979    
## clean_sexNon-Binary                            0.88961    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3621 on 205 degrees of freedom
## Multiple R-squared:  0.3647, Adjusted R-squared:  0.3306 
## F-statistic:  10.7 on 11 and 205 DF,  p-value: 1.767e-15

# unique IDs 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, stride_width_median_cm_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 29 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57389 -0.25335 -0.08085  0.09591  2.19408 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     1.35481    0.13211  10.255   <2e-16 ***
## stride_width_median_cm_pose_zv  0.02281    0.01027   2.222   0.0281 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3992 on 121 degrees of freedom
##   (29 observations deleted due to missingness)
## Multiple R-squared:  0.0392, Adjusted R-squared:  0.03126 
## F-statistic: 4.937 on 1 and 121 DF,  p-value: 0.02814

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.79622 -0.20573 -0.05697  0.12050  1.47791 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.445732   0.225611   6.408
## stride_width_median_cm_pose_zv                 0.003154   0.009727   0.324
## demoEHR_Age                                    0.006638   0.003186   2.083
## demoEHR_DiseaseDuration                       -0.001506   0.004586  -0.328
## ms_dx_condensedProgressive MS                  0.453504   0.095801   4.734
## ms_dx_condensedMS, Subtype Not Specified      -0.020583   0.255636  -0.081
## race_ethnicity_cleanBlack Or African American  0.133200   0.184329   0.723
## race_ethnicity_cleanHispanic or Latino        -0.110095   0.173265  -0.635
## race_ethnicity_cleanWhite Not Hispanic        -0.290387   0.150030  -1.936
## race_ethnicity_cleanOther/Unknown/Declined    -0.153722   0.190282  -0.808
## clean_sexMale                                 -0.089729   0.074282  -1.208
## clean_sexNon-Binary                            0.002518   0.353160   0.007
##                                               Pr(>|t|)    
## (Intercept)                                   3.68e-09 ***
## stride_width_median_cm_pose_zv                  0.7464    
## demoEHR_Age                                     0.0395 *  
## demoEHR_DiseaseDuration                         0.7432    
## ms_dx_condensedProgressive MS                 6.55e-06 ***
## ms_dx_condensedMS, Subtype Not Specified        0.9360    
## race_ethnicity_cleanBlack Or African American   0.4714    
## race_ethnicity_cleanHispanic or Latino          0.5265    
## race_ethnicity_cleanWhite Not Hispanic          0.0555 .  
## race_ethnicity_cleanOther/Unknown/Declined      0.4209    
## clean_sexMale                                   0.2296    
## clean_sexNon-Binary                             0.9943    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3477 on 111 degrees of freedom
##   (29 observations deleted due to missingness)
## Multiple R-squared:  0.3317, Adjusted R-squared:  0.2654 
## F-statistic: 5.008 on 11 and 111 DF,  p-value: 2.677e-06

Univariate - PWS, Stance Time –> T25fw

Stance/swing/double/single support measures not calculated for all participants

# PWS 
sum(is.finite(zeno_pws_df$foot1_stance_time_mean_pose_zv))
## [1] 58
ggplot(data = zeno_pws_df, aes(x = foot1_stance_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_stance_per_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

#video model  
metric_regression(zeno_pws_df, t25fw_log, foot1_stance_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 159 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5121 -0.1483 -0.0231  0.1114  0.9443 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      1.0634     0.2105   5.052 4.97e-06 ***
## foot1_stance_time_mean_pose_zv   0.7250     0.2745   2.641   0.0107 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2743 on 56 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.1107, Adjusted R-squared:  0.09487 
## F-statistic: 6.974 on 1 and 56 DF,  p-value: 0.0107

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50093 -0.15215  0.00611  0.13374  0.80566 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.017779   0.272871   3.730
## foot1_stance_time_mean_pose_zv                 0.625083   0.273156   2.288
## demoEHR_Age                                    0.002425   0.004031   0.602
## demoEHR_DiseaseDuration                        0.003317   0.005412   0.613
## ms_dx_condensedProgressive MS                  0.181272   0.130976   1.384
## race_ethnicity_cleanBlack Or African American  0.411453   0.188757   2.180
## race_ethnicity_cleanHispanic or Latino        -0.089447   0.137070  -0.653
## race_ethnicity_cleanWhite Not Hispanic        -0.085178   0.127121  -0.670
## clean_sexMale                                  0.002421   0.084688   0.029
##                                               Pr(>|t|)    
## (Intercept)                                   0.000498 ***
## foot1_stance_time_mean_pose_zv                0.026467 *  
## demoEHR_Age                                   0.550174    
## demoEHR_DiseaseDuration                       0.542798    
## ms_dx_condensedProgressive MS                 0.172629    
## race_ethnicity_cleanBlack Or African American 0.034106 *  
## race_ethnicity_cleanHispanic or Latino        0.517087    
## race_ethnicity_cleanWhite Not Hispanic        0.505968    
## clean_sexMale                                 0.977307    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2578 on 49 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.3129, Adjusted R-squared:  0.2007 
## F-statistic: 2.789 on 8 and 49 DF,  p-value: 0.01258

# no pressure mat value 

# unique IDs 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, foot1_stance_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 122 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.36932 -0.24090 -0.02433  0.16763  0.77262 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                      0.9217     0.2814   3.276  0.00281 **
## foot1_stance_time_mean_pose_zv   1.0732     0.3726   2.880  0.00754 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.284 on 28 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.2285, Adjusted R-squared:  0.201 
## F-statistic: 8.295 on 1 and 28 DF,  p-value: 0.00754

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.3220 -0.1738 -0.0485  0.1697  0.6210 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.165880   0.372639   3.129
## foot1_stance_time_mean_pose_zv                 0.990039   0.402816   2.458
## demoEHR_Age                                   -0.001072   0.005007  -0.214
## demoEHR_DiseaseDuration                        0.005048   0.007126   0.708
## ms_dx_condensedProgressive MS                  0.179869   0.166100   1.083
## race_ethnicity_cleanBlack Or African American  0.326953   0.261415   1.251
## race_ethnicity_cleanHispanic or Latino        -0.152081   0.210890  -0.721
## race_ethnicity_cleanWhite Not Hispanic        -0.268644   0.190168  -1.413
## clean_sexMale                                 -0.085978   0.131760  -0.653
##                                               Pr(>|t|)   
## (Intercept)                                    0.00508 **
## foot1_stance_time_mean_pose_zv                 0.02276 * 
## demoEHR_Age                                    0.83254   
## demoEHR_DiseaseDuration                        0.48646   
## ms_dx_condensedProgressive MS                  0.29113   
## race_ethnicity_cleanBlack Or African American  0.22480   
## race_ethnicity_cleanHispanic or Latino         0.47878   
## race_ethnicity_cleanWhite Not Hispanic         0.17240   
## clean_sexMale                                  0.52114   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2712 on 21 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.4727, Adjusted R-squared:  0.2718 
## F-statistic: 2.353 on 8 and 21 DF,  p-value: 0.05555

Univariate - PWS, Swing Time –> T25fw

# PWS 
sum(is.finite(zeno_pws_df$foot1_swing_time_mean_pose_zv))
## [1] 58
ggplot(data = zeno_pws_df, aes(x = foot1_swing_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_swing_per_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

#video model  
metric_regression(zeno_pws_df, t25fw_log, foot1_swing_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 159 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_swing_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.45529 -0.16233 -0.04102  0.12953  1.09583 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     1.3620     0.1905   7.148 1.97e-09 ***
## foot1_swing_time_mean_pose_zv   0.6748     0.5059   1.334    0.188    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2864 on 56 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.03079,    Adjusted R-squared:  0.01349 
## F-statistic: 1.779 on 1 and 56 DF,  p-value: 0.1876

## [1] "t25fw_log ~ foot1_swing_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.46218 -0.12759 -0.02431  0.12562  0.87576 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.306485   0.273642   4.774
## foot1_swing_time_mean_pose_zv                  0.419610   0.503006   0.834
## demoEHR_Age                                    0.002587   0.004215   0.614
## demoEHR_DiseaseDuration                        0.002093   0.005635   0.372
## ms_dx_condensedProgressive MS                  0.255542   0.133859   1.909
## race_ethnicity_cleanBlack Or African American  0.410745   0.202207   2.031
## race_ethnicity_cleanHispanic or Latino        -0.086843   0.143656  -0.605
## race_ethnicity_cleanWhite Not Hispanic        -0.060207   0.132270  -0.455
## clean_sexMale                                  0.036508   0.086870   0.420
##                                               Pr(>|t|)    
## (Intercept)                                   1.67e-05 ***
## foot1_swing_time_mean_pose_zv                   0.4082    
## demoEHR_Age                                     0.5422    
## demoEHR_DiseaseDuration                         0.7119    
## ms_dx_condensedProgressive MS                   0.0621 .  
## race_ethnicity_cleanBlack Or African American   0.0477 *  
## race_ethnicity_cleanHispanic or Latino          0.5483    
## race_ethnicity_cleanWhite Not Hispanic          0.6510    
## clean_sexMale                                   0.6761    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2693 on 49 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.2501, Adjusted R-squared:  0.1277 
## F-statistic: 2.043 on 8 and 49 DF,  p-value: 0.06047

# no pressure mat value 

# unique IDs 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, foot1_swing_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 122 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_swing_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.42629 -0.18620 -0.07886  0.11899  0.96976 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     1.5843     0.2696   5.877 2.55e-06 ***
## foot1_swing_time_mean_pose_zv   0.3540     0.6953   0.509    0.615    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3219 on 28 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.009169,   Adjusted R-squared:  -0.02622 
## F-statistic: 0.2591 on 1 and 28 DF,  p-value: 0.6147

## [1] "t25fw_log ~ foot1_swing_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.34769 -0.20452 -0.03124  0.11781  0.69450 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.7590522  0.4453506   3.950
## foot1_swing_time_mean_pose_zv                 -0.0110863  0.7343771  -0.015
## demoEHR_Age                                    0.0005365  0.0056348   0.095
## demoEHR_DiseaseDuration                        0.0037865  0.0081471   0.465
## ms_dx_condensedProgressive MS                  0.3281831  0.1760724   1.864
## race_ethnicity_cleanBlack Or African American  0.3877825  0.2981793   1.301
## race_ethnicity_cleanHispanic or Latino        -0.1017299  0.2389752  -0.426
## race_ethnicity_cleanWhite Not Hispanic        -0.2277727  0.2173307  -1.048
## clean_sexMale                                 -0.0160778  0.1461782  -0.110
##                                               Pr(>|t|)    
## (Intercept)                                   0.000732 ***
## foot1_swing_time_mean_pose_zv                 0.988098    
## demoEHR_Age                                   0.925054    
## demoEHR_DiseaseDuration                       0.646878    
## ms_dx_condensedProgressive MS                 0.076377 .  
## race_ethnicity_cleanBlack Or African American 0.207521    
## race_ethnicity_cleanHispanic or Latino        0.674663    
## race_ethnicity_cleanWhite Not Hispanic        0.306530    
## clean_sexMale                                 0.913464    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3077 on 21 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.321,  Adjusted R-squared:  0.06234 
## F-statistic: 1.241 on 8 and 21 DF,  p-value: 0.3246

Univariate - PWS, Single and Double Support –> T25fw

# PWS 
sum(is.finite(zeno_pws_df$foot1_double_support_per_mean_pose_zv))
## [1] 58
ggplot(data = zeno_pws_df, aes(x = foot1_double_support_per_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_ini_double_support_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_single_support_per_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_term_double_support_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = foot1_tot_double_support_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 159 rows containing missing values (`geom_point()`).

# try terminal double support time 
metric_regression(zeno_pws_df, t25fw_log, foot1_term_double_support_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 159 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.46652 -0.13854 -0.04039  0.16264  0.87022 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                  1.40581    0.07162  19.628
## foot1_term_double_support_time_mean_pose_zv  0.96059    0.29240   3.285
##                                             Pr(>|t|)    
## (Intercept)                                  < 2e-16 ***
## foot1_term_double_support_time_mean_pose_zv  0.00176 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2664 on 56 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.1616, Adjusted R-squared:  0.1466 
## F-statistic: 10.79 on 1 and 56 DF,  p-value: 0.001762

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47253 -0.13502 -0.03502  0.10785  0.78821 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.298238   0.204473   6.349
## foot1_term_double_support_time_mean_pose_zv    0.742819   0.322892   2.301
## demoEHR_Age                                    0.002214   0.004030   0.549
## demoEHR_DiseaseDuration                        0.005164   0.005536   0.933
## ms_dx_condensedProgressive MS                  0.131781   0.137203   0.960
## race_ethnicity_cleanBlack Or African American  0.347911   0.193138   1.801
## race_ethnicity_cleanHispanic or Latino        -0.047579   0.137428  -0.346
## race_ethnicity_cleanWhite Not Hispanic        -0.066865   0.126586  -0.528
## clean_sexMale                                  0.042009   0.082956   0.506
##                                               Pr(>|t|)    
## (Intercept)                                   6.76e-08 ***
## foot1_term_double_support_time_mean_pose_zv     0.0257 *  
## demoEHR_Age                                     0.5852    
## demoEHR_DiseaseDuration                         0.3555    
## ms_dx_condensedProgressive MS                   0.3415    
## race_ethnicity_cleanBlack Or African American   0.0778 .  
## race_ethnicity_cleanHispanic or Latino          0.7307    
## race_ethnicity_cleanWhite Not Hispanic          0.5997    
## clean_sexMale                                   0.6148    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2576 on 49 degrees of freedom
##   (159 observations deleted due to missingness)
## Multiple R-squared:  0.3136, Adjusted R-squared:  0.2015 
## F-statistic: 2.798 on 8 and 49 DF,  p-value: 0.01234

# unique IDs 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, foot1_term_double_support_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 122 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47957 -0.21192 -0.01916  0.19843  0.75915 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                  1.48305    0.08981  16.513
## foot1_term_double_support_time_mean_pose_zv  1.04515    0.32959   3.171
##                                             Pr(>|t|)    
## (Intercept)                                 5.77e-16 ***
## foot1_term_double_support_time_mean_pose_zv  0.00366 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2774 on 28 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.2642, Adjusted R-squared:  0.238 
## F-statistic: 10.06 on 1 and 28 DF,  p-value: 0.003664

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.29714 -0.19772 -0.03331  0.10630  0.63890 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.6517784  0.3007771   5.492
## foot1_term_double_support_time_mean_pose_zv    0.8110046  0.4014502   2.020
## demoEHR_Age                                   -0.0007846  0.0051959  -0.151
## demoEHR_DiseaseDuration                        0.0059087  0.0074536   0.793
## ms_dx_condensedProgressive MS                  0.1760955  0.1774567   0.992
## race_ethnicity_cleanBlack Or African American  0.2183771  0.2828617   0.772
## race_ethnicity_cleanHispanic or Latino        -0.1146077  0.2180385  -0.526
## race_ethnicity_cleanWhite Not Hispanic        -0.2338653  0.1967099  -1.189
## clean_sexMale                                 -0.0104773  0.1336019  -0.078
##                                               Pr(>|t|)    
## (Intercept)                                    1.9e-05 ***
## foot1_term_double_support_time_mean_pose_zv     0.0563 .  
## demoEHR_Age                                     0.8814    
## demoEHR_DiseaseDuration                         0.4368    
## ms_dx_condensedProgressive MS                   0.3323    
## race_ethnicity_cleanBlack Or African American   0.4487    
## race_ethnicity_cleanHispanic or Latino          0.6047    
## race_ethnicity_cleanWhite Not Hispanic          0.2478    
## clean_sexMale                                   0.9382    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2816 on 21 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.4315, Adjusted R-squared:  0.2149 
## F-statistic: 1.992 on 8 and 21 DF,  p-value: 0.09835

# mat double support 
metric_regression(zeno_pws_df, t25fw_log, PWS_totaldsupportmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ PWS_totaldsupportmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.12428 -0.20113 -0.05144  0.12347  1.24210 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.887291   0.061276   14.48   <2e-16 ***
## PWS_totaldsupportmean 0.022743   0.001745   13.04   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3315 on 215 degrees of freedom
## Multiple R-squared:  0.4414, Adjusted R-squared:  0.4388 
## F-statistic: 169.9 on 1 and 215 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ PWS_totaldsupportmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.78132 -0.15720 -0.04603  0.12134  1.14323 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.855723   0.121922   7.019
## PWS_totaldsupportmean                          0.019008   0.001789  10.625
## demoEHR_Age                                    0.006192   0.002297   2.695
## demoEHR_DiseaseDuration                       -0.002157   0.003026  -0.713
## ms_dx_condensedProgressive MS                  0.224710   0.066436   3.382
## ms_dx_condensedMS, Subtype Not Specified      -0.003515   0.224517  -0.016
## race_ethnicity_cleanBlack Or African American  0.049273   0.115178   0.428
## race_ethnicity_cleanHispanic or Latino        -0.119580   0.103274  -1.158
## race_ethnicity_cleanWhite Not Hispanic        -0.205655   0.084148  -2.444
## race_ethnicity_cleanOther/Unknown/Declined    -0.131118   0.106288  -1.234
## clean_sexMale                                 -0.053597   0.051050  -1.050
## clean_sexNon-Binary                            0.036730   0.222890   0.165
##                                               Pr(>|t|)    
## (Intercept)                                   3.22e-11 ***
## PWS_totaldsupportmean                          < 2e-16 ***
## demoEHR_Age                                   0.007614 ** 
## demoEHR_DiseaseDuration                       0.476884    
## ms_dx_condensedProgressive MS                 0.000861 ***
## ms_dx_condensedMS, Subtype Not Specified      0.987526    
## race_ethnicity_cleanBlack Or African American 0.669247    
## race_ethnicity_cleanHispanic or Latino        0.248258    
## race_ethnicity_cleanWhite Not Hispanic        0.015372 *  
## race_ethnicity_cleanOther/Unknown/Declined    0.218759    
## clean_sexMale                                 0.295005    
## clean_sexNon-Binary                           0.869271    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3097 on 205 degrees of freedom
## Multiple R-squared:  0.5352, Adjusted R-squared:  0.5102 
## F-statistic: 21.46 on 11 and 205 DF,  p-value: < 2.2e-16

zeno_pws_df$log_PWS_totaldsupportmean <- log(zeno_pws_df$PWS_totaldsupportmean)
metric_regression(zeno_pws_df, t25fw_log, log_PWS_totaldsupportmean)
## [1] "Data Frame:  zeno_pws_df"

## [1] "t25fw_log ~ log_PWS_totaldsupportmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.38174 -0.17182 -0.02423  0.15015  0.88946 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)               -3.64659    0.27590  -13.22   <2e-16 ***
## log_PWS_totaldsupportmean  1.52906    0.07977   19.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2695 on 215 degrees of freedom
## Multiple R-squared:  0.6308, Adjusted R-squared:  0.6291 
## F-statistic: 367.4 on 1 and 215 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_PWS_totaldsupportmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.3059 -0.1497 -0.0212  0.1166  0.8261 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                   -3.275760   0.302932 -10.814
## log_PWS_totaldsupportmean                      1.413987   0.088181  16.035
## demoEHR_Age                                    0.005156   0.001908   2.702
## demoEHR_DiseaseDuration                       -0.002041   0.002508  -0.814
## ms_dx_condensedProgressive MS                  0.101121   0.056559   1.788
## ms_dx_condensedMS, Subtype Not Specified       0.038323   0.186249   0.206
## race_ethnicity_cleanBlack Or African American -0.134514   0.096995  -1.387
## race_ethnicity_cleanHispanic or Latino        -0.174660   0.085826  -2.035
## race_ethnicity_cleanWhite Not Hispanic        -0.241929   0.069888  -3.462
## race_ethnicity_cleanOther/Unknown/Declined    -0.181906   0.088285  -2.060
## clean_sexMale                                 -0.095291   0.042432  -2.246
## clean_sexNon-Binary                            0.022332   0.184851   0.121
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## log_PWS_totaldsupportmean                      < 2e-16 ***
## demoEHR_Age                                   0.007467 ** 
## demoEHR_DiseaseDuration                       0.416689    
## ms_dx_condensedProgressive MS                 0.075270 .  
## ms_dx_condensedMS, Subtype Not Specified      0.837180    
## race_ethnicity_cleanBlack Or African American 0.167005    
## race_ethnicity_cleanHispanic or Latino        0.043132 *  
## race_ethnicity_cleanWhite Not Hispanic        0.000653 ***
## race_ethnicity_cleanOther/Unknown/Declined    0.040619 *  
## clean_sexMale                                 0.025789 *  
## clean_sexNon-Binary                           0.903958    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2569 on 205 degrees of freedom
## Multiple R-squared:  0.6803, Adjusted R-squared:  0.6631 
## F-statistic: 39.65 on 11 and 205 DF,  p-value: < 2.2e-16

Multivariate - PWS, Gait metrics only –> T25fw

Metrics only - not including double support/stance measures, too many missing. May include after improving code

# PWS 

# confounding + 
pws_t25fw_multivar_model <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.79102 -0.20897 -0.04041  0.13623  1.24196 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         0.698883   0.520653   1.342  0.18149    
## log_delta_pix_h_rel_median_pose_zv -0.179348   0.058299  -3.076  0.00249 ** 
## stride_time_median_sec_pose_zv      0.480250   0.233544   2.056  0.04146 *  
## mean_cadence_step_per_min_pose_zv  -0.002185   0.002759  -0.792  0.42969    
## stride_width_median_cm_pose_zv      0.027336   0.007860   3.478  0.00066 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3095 on 152 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.2844, Adjusted R-squared:  0.2655 
## F-statistic:  15.1 on 4 and 152 DF,  p-value: 2.048e-10
hist(resid(pws_t25fw_multivar_model))

# PWS interaction * 
pws_t25fw_multivar_model_2 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv * 
                                 stride_time_median_sec_pose_zv * 
                                 mean_cadence_step_per_min_pose_zv * 
                                 stride_width_median_cm_pose_zv, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model_2)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv * 
##     stride_time_median_sec_pose_zv * mean_cadence_step_per_min_pose_zv * 
##     stride_width_median_cm_pose_zv, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68168 -0.17935 -0.02735  0.13538  1.19404 
## 
## Coefficients:
##                                                                                                                                      Estimate
## (Intercept)                                                                                                                        -19.950547
## log_delta_pix_h_rel_median_pose_zv                                                                                                  -1.898243
## stride_time_median_sec_pose_zv                                                                                                      19.453924
## mean_cadence_step_per_min_pose_zv                                                                                                    0.183459
## stride_width_median_cm_pose_zv                                                                                                       2.099951
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    3.140075
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.019423
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                    -0.168232
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.486981
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                       -1.852010
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                    -0.017724
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 -0.029751
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    -0.519144
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 -0.004034
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.015654
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.004216
##                                                                                                                                    Std. Error
## (Intercept)                                                                                                                         15.280293
## log_delta_pix_h_rel_median_pose_zv                                                                                                  10.748354
## stride_time_median_sec_pose_zv                                                                                                      11.755009
## mean_cadence_step_per_min_pose_zv                                                                                                    0.128764
## stride_width_median_cm_pose_zv                                                                                                       1.220568
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    7.253678
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.098987
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                     0.100479
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.799679
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        0.995378
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                     0.010540
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  0.070700
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     0.546177
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  0.007378
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.008756
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.005222
##                                                                                                                                    t value
## (Intercept)                                                                                                                         -1.306
## log_delta_pix_h_rel_median_pose_zv                                                                                                  -0.177
## stride_time_median_sec_pose_zv                                                                                                       1.655
## mean_cadence_step_per_min_pose_zv                                                                                                    1.425
## stride_width_median_cm_pose_zv                                                                                                       1.720
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    0.433
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.196
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                    -1.674
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.609
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                       -1.861
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                    -1.682
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 -0.421
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    -0.951
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 -0.547
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      1.788
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.807
##                                                                                                                                    Pr(>|t|)
## (Intercept)                                                                                                                          0.1938
## log_delta_pix_h_rel_median_pose_zv                                                                                                   0.8601
## stride_time_median_sec_pose_zv                                                                                                       0.1002
## mean_cadence_step_per_min_pose_zv                                                                                                    0.1564
## stride_width_median_cm_pose_zv                                                                                                       0.0875
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    0.6658
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.8447
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                     0.0963
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.5435
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        0.0649
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                     0.0949
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  0.6745
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     0.3435
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  0.5854
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.0760
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.4208
##                                                                                                                                     
## (Intercept)                                                                                                                         
## log_delta_pix_h_rel_median_pose_zv                                                                                                  
## stride_time_median_sec_pose_zv                                                                                                      
## mean_cadence_step_per_min_pose_zv                                                                                                   
## stride_width_median_cm_pose_zv                                                                                                     .
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                   
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                   .
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                   
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                      .
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                   .
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                    .
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2745 on 141 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4779, Adjusted R-squared:  0.4223 
## F-statistic: 8.603 on 15 and 141 DF,  p-value: 8.904e-14
hist(resid(pws_t25fw_multivar_model_2))

Multivariate - PWS, Gait metrics + disease + demographics –> T25fw

# PWS 
# Metrics + disease and demographic info 
# add MS subtype 
pws_t25fw_multivar_model_3 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model_3)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.76721 -0.19501 -0.04181  0.14730  1.19160 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.890449   0.525961   1.693  0.09253
## log_delta_pix_h_rel_median_pose_zv       -0.155942   0.059180  -2.635  0.00930
## stride_time_median_sec_pose_zv            0.408772   0.234663   1.742  0.08357
## mean_cadence_step_per_min_pose_zv        -0.002526   0.002749  -0.919  0.35965
## stride_width_median_cm_pose_zv            0.022193   0.008228   2.697  0.00779
## ms_dx_condensedProgressive MS             0.166632   0.082591   2.018  0.04542
## ms_dx_condensedMS, Subtype Not Specified  0.031242   0.220317   0.142  0.88742
##                                            
## (Intercept)                              . 
## log_delta_pix_h_rel_median_pose_zv       **
## stride_time_median_sec_pose_zv           . 
## mean_cadence_step_per_min_pose_zv          
## stride_width_median_cm_pose_zv           **
## ms_dx_condensedProgressive MS            * 
## ms_dx_condensedMS, Subtype Not Specified   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3074 on 150 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.3033, Adjusted R-squared:  0.2754 
## F-statistic: 10.88 on 6 and 150 DF,  p-value: 4.851e-10
hist(resid(pws_t25fw_multivar_model_3))

# add age 
pws_t25fw_multivar_model_4 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model_4)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age, 
##     data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.76560 -0.18098 -0.03939  0.11653  1.19800 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.516580   0.528061   0.978  0.32953
## log_delta_pix_h_rel_median_pose_zv       -0.171593   0.057940  -2.962  0.00356
## stride_time_median_sec_pose_zv            0.460465   0.229453   2.007  0.04658
## mean_cadence_step_per_min_pose_zv        -0.002597   0.002680  -0.969  0.33407
## stride_width_median_cm_pose_zv            0.022179   0.008022   2.765  0.00641
## ms_dx_condensedProgressive MS             0.083888   0.085219   0.984  0.32652
## ms_dx_condensedMS, Subtype Not Specified -0.086723   0.218454  -0.397  0.69195
## demoEHR_Age                               0.006334   0.002135   2.966  0.00351
##                                            
## (Intercept)                                
## log_delta_pix_h_rel_median_pose_zv       **
## stride_time_median_sec_pose_zv           * 
## mean_cadence_step_per_min_pose_zv          
## stride_width_median_cm_pose_zv           **
## ms_dx_condensedProgressive MS              
## ms_dx_condensedMS, Subtype Not Specified   
## demoEHR_Age                              **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2997 on 149 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.3421, Adjusted R-squared:  0.3112 
## F-statistic: 11.07 on 7 and 149 DF,  p-value: 3.155e-11
hist(resid(pws_t25fw_multivar_model_4))

# add disease duration 
pws_t25fw_multivar_model_5 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model_5)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.75055 -0.20106 -0.03773  0.12279  1.22751 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.537966   0.529577   1.016  0.31136
## log_delta_pix_h_rel_median_pose_zv       -0.167871   0.058231  -2.883  0.00453
## stride_time_median_sec_pose_zv            0.476349   0.230742   2.064  0.04072
## mean_cadence_step_per_min_pose_zv        -0.002703   0.002688  -1.006  0.31614
## stride_width_median_cm_pose_zv            0.021763   0.008052   2.703  0.00768
## ms_dx_condensedProgressive MS             0.078772   0.085609   0.920  0.35900
## ms_dx_condensedMS, Subtype Not Specified -0.090385   0.218822  -0.413  0.68016
## demoEHR_Age                               0.005436   0.002446   2.222  0.02780
## demoEHR_DiseaseDuration                   0.002653   0.003509   0.756  0.45077
##                                            
## (Intercept)                                
## log_delta_pix_h_rel_median_pose_zv       **
## stride_time_median_sec_pose_zv           * 
## mean_cadence_step_per_min_pose_zv          
## stride_width_median_cm_pose_zv           **
## ms_dx_condensedProgressive MS              
## ms_dx_condensedMS, Subtype Not Specified   
## demoEHR_Age                              * 
## demoEHR_DiseaseDuration                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3001 on 148 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.3447, Adjusted R-squared:  0.3092 
## F-statistic: 9.729 on 8 and 148 DF,  p-value: 8.482e-11
hist(resid(pws_t25fw_multivar_model_5))

# add race and ethnicity 
pws_t25fw_multivar_model_6 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration + 
                                 race_ethnicity_clean, 
                               data = zeno_pws_df)

summary(pws_t25fw_multivar_model_6)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = zeno_pws_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.69971 -0.16441 -0.02223  0.11795  1.18667 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.841785   0.521249   1.615
## log_delta_pix_h_rel_median_pose_zv            -0.164947   0.055873  -2.952
## stride_time_median_sec_pose_zv                 0.360265   0.218411   1.649
## mean_cadence_step_per_min_pose_zv             -0.003413   0.002573  -1.326
## stride_width_median_cm_pose_zv                 0.014601   0.007732   1.888
## ms_dx_condensedProgressive MS                  0.129769   0.080907   1.604
## ms_dx_condensedMS, Subtype Not Specified      -0.040427   0.205264  -0.197
## demoEHR_Age                                    0.006561   0.002446   2.682
## demoEHR_DiseaseDuration                        0.002179   0.003292   0.662
## race_ethnicity_cleanBlack Or African American  0.317858   0.124205   2.559
## race_ethnicity_cleanHispanic or Latino        -0.052037   0.117537  -0.443
## race_ethnicity_cleanWhite Not Hispanic        -0.115362   0.098188  -1.175
## race_ethnicity_cleanOther/Unknown/Declined    -0.018505   0.132571  -0.140
##                                               Pr(>|t|)   
## (Intercept)                                    0.10851   
## log_delta_pix_h_rel_median_pose_zv             0.00369 **
## stride_time_median_sec_pose_zv                 0.10123   
## mean_cadence_step_per_min_pose_zv              0.18691   
## stride_width_median_cm_pose_zv                 0.06099 . 
## ms_dx_condensedProgressive MS                  0.11092   
## ms_dx_condensedMS, Subtype Not Specified       0.84414   
## demoEHR_Age                                    0.00818 **
## demoEHR_DiseaseDuration                        0.50900   
## race_ethnicity_cleanBlack Or African American  0.01153 * 
## race_ethnicity_cleanHispanic or Latino         0.65863   
## race_ethnicity_cleanWhite Not Hispanic         0.24197   
## race_ethnicity_cleanOther/Unknown/Declined     0.88919   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.281 on 144 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4409, Adjusted R-squared:  0.3943 
## F-statistic: 9.463 on 12 and 144 DF,  p-value: 2.374e-13
hist(resid(pws_t25fw_multivar_model_6))

Fast Walking Speed –> T25fw

Demographics and disease info

# Fast Walking speed participants 

fw_dem_model <- lm(t25fw_log ~ demoEHR_Age + 
                     demoEHR_DiseaseDuration + 
                     ms_dx_condensed + 
                     race_ethnicity_clean + 
                     clean_sex,
                   data = zeno_fw_df)

summary(fw_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + race_ethnicity_clean + clean_sex, data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.04904 -0.21155 -0.05219  0.13159  1.78029 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.337602   0.139803   9.568
## demoEHR_Age                                    0.007637   0.002837   2.692
## demoEHR_DiseaseDuration                       -0.004296   0.003735  -1.150
## ms_dx_condensedProgressive MS                  0.464139   0.077080   6.021
## ms_dx_condensedMS, Subtype Not Specified      -0.035212   0.278365  -0.126
## race_ethnicity_cleanBlack Or African American  0.179691   0.141982   1.266
## race_ethnicity_cleanHispanic or Latino        -0.061529   0.127929  -0.481
## race_ethnicity_cleanWhite Not Hispanic        -0.160184   0.104237  -1.537
## race_ethnicity_cleanOther/Unknown/Declined    -0.088865   0.131740  -0.675
## clean_sexMale                                 -0.051636   0.063302  -0.816
## clean_sexNon-Binary                            0.007643   0.276484   0.028
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## demoEHR_Age                                    0.00768 ** 
## demoEHR_DiseaseDuration                        0.25131    
## ms_dx_condensedProgressive MS                 7.77e-09 ***
## ms_dx_condensedMS, Subtype Not Specified       0.89946    
## race_ethnicity_cleanBlack Or African American  0.20708    
## race_ethnicity_cleanHispanic or Latino         0.63105    
## race_ethnicity_cleanWhite Not Hispanic         0.12589    
## race_ethnicity_cleanOther/Unknown/Declined     0.50071    
## clean_sexMale                                  0.41561    
## clean_sexNon-Binary                            0.97797    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3842 on 207 degrees of freedom
## Multiple R-squared:  0.2786, Adjusted R-squared:  0.2437 
## F-statistic: 7.993 on 10 and 207 DF,  p-value: 7.383e-11
hist(resid(fw_dem_model))

# unique IDs 
fw_dem_model_2 <- lm(t25fw_log ~ demoEHR_Age + 
                     demoEHR_DiseaseDuration + 
                     ms_dx_condensed + 
                     ms_dx_condensed + 
                     clean_sex,
                   data = zeno_fw_uniqueid_df)

summary(fw_dem_model_2)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + ms_dx_condensed + clean_sex, data = zeno_fw_uniqueid_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74546 -0.21175 -0.05542  0.13677  1.56730 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.362464   0.134571  10.124  < 2e-16
## demoEHR_Age                               0.004441   0.002933   1.514    0.132
## demoEHR_DiseaseDuration                  -0.002086   0.004571  -0.456    0.649
## ms_dx_condensedProgressive MS             0.504910   0.086688   5.824 3.55e-08
## ms_dx_condensedMS, Subtype Not Specified -0.055911   0.275970  -0.203    0.840
## clean_sexMale                            -0.028488   0.071505  -0.398    0.691
## clean_sexNon-Binary                      -0.062676   0.382089  -0.164    0.870
##                                             
## (Intercept)                              ***
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ms_dx_condensedProgressive MS            ***
## ms_dx_condensedMS, Subtype Not Specified    
## clean_sexMale                               
## clean_sexNon-Binary                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3783 on 145 degrees of freedom
## Multiple R-squared:  0.2571, Adjusted R-squared:  0.2264 
## F-statistic: 8.364 on 6 and 145 DF,  p-value: 8.591e-08
hist(resid(fw_dem_model_2))

Univariate - FW, delta pixel proxy –> T25fw

sum(is.finite(zeno_fw_df$delta_pix_h_rel_median_pose_zv))
## [1] 215
zeno_fw_df$log_delta_pix_h_rel_median_pose_zv <-log(zeno_fw_df$delta_pix_h_rel_median_pose_zv)
zeno_fw_df$sqrt_delta_pix_h_rel_median_pose_zv <- sqrt(zeno_fw_df$delta_pix_h_rel_median_pose_zv)

# drop 
zeno_fw_df <- zeno_fw_df %>% filter(is.finite(log_delta_pix_h_rel_median_pose_zv))
nrow(zeno_fw_df)
## [1] 214
# log T25FW 
ggplot(data = zeno_fw_df, aes(x = delta_pix_h_rel_median_pose_zv, y =  t25fw_log)) + 
  geom_point()

ggplot(data = zeno_fw_df, aes(x = log_delta_pix_h_rel_median_pose_zv, y = t25fw_log)) + 
  geom_point()

ggplot(data = zeno_fw_df, aes(x = sqrt_delta_pix_h_rel_median_pose_zv, y = t25fw_log)) + 
  geom_point()

# log velproxy and log t25Fw
metric_regression(zeno_fw_df, t25fw_log, log_delta_pix_h_rel_median_pose_zv)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.26427 -0.18434 -0.03673  0.12861  1.68174 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         1.06395    0.04933   21.57   <2e-16 ***
## log_delta_pix_h_rel_median_pose_zv -0.53911    0.04142  -13.02   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3328 on 212 degrees of freedom
## Multiple R-squared:  0.4442, Adjusted R-squared:  0.4415 
## F-statistic: 169.4 on 1 and 212 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.98030 -0.16891 -0.00078  0.13002  1.42428 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.982743   0.121667   8.077
## log_delta_pix_h_rel_median_pose_zv            -0.442881   0.042902 -10.323
## demoEHR_Age                                    0.005034   0.002359   2.134
## demoEHR_DiseaseDuration                       -0.003905   0.003096  -1.261
## ms_dx_condensedProgressive MS                  0.260872   0.066180   3.942
## ms_dx_condensedMS, Subtype Not Specified       0.259071   0.322729   0.803
## race_ethnicity_cleanBlack Or African American  0.117963   0.117509   1.004
## race_ethnicity_cleanHispanic or Latino        -0.098009   0.107737  -0.910
## race_ethnicity_cleanWhite Not Hispanic        -0.093375   0.087275  -1.070
## race_ethnicity_cleanOther/Unknown/Declined    -0.059841   0.109121  -0.548
## clean_sexMale                                 -0.027375   0.053168  -0.515
## clean_sexNon-Binary                            0.050453   0.226106   0.223
##                                               Pr(>|t|)    
## (Intercept)                                   5.91e-14 ***
## log_delta_pix_h_rel_median_pose_zv             < 2e-16 ***
## demoEHR_Age                                   0.034025 *  
## demoEHR_DiseaseDuration                       0.208680    
## ms_dx_condensedProgressive MS                 0.000111 ***
## ms_dx_condensedMS, Subtype Not Specified      0.423062    
## race_ethnicity_cleanBlack Or African American 0.316646    
## race_ethnicity_cleanHispanic or Latino        0.364063    
## race_ethnicity_cleanWhite Not Hispanic        0.285943    
## race_ethnicity_cleanOther/Unknown/Declined    0.584028    
## clean_sexMale                                 0.607208    
## clean_sexNon-Binary                           0.823652    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3141 on 202 degrees of freedom
## Multiple R-squared:  0.5284, Adjusted R-squared:  0.5028 
## F-statistic: 20.58 on 11 and 202 DF,  p-value: < 2.2e-16

# true FW velocity from mat and t25fw 
metric_regression(zeno_fw_df, t25fw_log, FW_velocitycmsecmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ FW_velocitycmsecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61784 -0.10610 -0.02210  0.09633  1.30904 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           2.874161   0.057933   49.61   <2e-16 ***
## FW_velocitycmsecmean -0.008315   0.000372  -22.36   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2436 on 212 degrees of freedom
## Multiple R-squared:  0.7022, Adjusted R-squared:  0.7008 
## F-statistic: 499.8 on 1 and 212 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ FW_velocitycmsecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61197 -0.11747 -0.01485  0.10063  1.23481 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    2.8621272  0.1267148  22.587
## FW_velocitycmsecmean                          -0.0080401  0.0004630 -17.366
## demoEHR_Age                                   -0.0009546  0.0019017  -0.502
## demoEHR_DiseaseDuration                       -0.0015267  0.0024297  -0.628
## ms_dx_condensedProgressive MS                  0.1146547  0.0533962   2.147
## ms_dx_condensedMS, Subtype Not Specified       0.0756038  0.2527457   0.299
## race_ethnicity_cleanBlack Or African American  0.0102379  0.0923861   0.111
## race_ethnicity_cleanHispanic or Latino        -0.0027676  0.0843402  -0.033
## race_ethnicity_cleanWhite Not Hispanic         0.0075481  0.0688067   0.110
## race_ethnicity_cleanOther/Unknown/Declined     0.0518258  0.0857746   0.604
## clean_sexMale                                  0.0094030  0.0417386   0.225
## clean_sexNon-Binary                            0.1250206  0.1770966   0.706
##                                               Pr(>|t|)    
## (Intercept)                                     <2e-16 ***
## FW_velocitycmsecmean                            <2e-16 ***
## demoEHR_Age                                      0.616    
## demoEHR_DiseaseDuration                          0.530    
## ms_dx_condensedProgressive MS                    0.033 *  
## ms_dx_condensedMS, Subtype Not Specified         0.765    
## race_ethnicity_cleanBlack Or African American    0.912    
## race_ethnicity_cleanHispanic or Latino           0.974    
## race_ethnicity_cleanWhite Not Hispanic           0.913    
## race_ethnicity_cleanOther/Unknown/Declined       0.546    
## clean_sexMale                                    0.822    
## clean_sexNon-Binary                              0.481    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2458 on 202 degrees of freedom
## Multiple R-squared:  0.711,  Adjusted R-squared:  0.6953 
## F-statistic: 45.19 on 11 and 202 DF,  p-value: < 2.2e-16

# unique IDs 
zeno_fw_uniqueid_df$log_delta_pix_h_rel_median_pose_zv <- log(zeno_fw_uniqueid_df$delta_pix_h_rel_median_pose_zv)
zeno_fw_uniqueid_df[] <- lapply(zeno_fw_uniqueid_df, function(x) {
  if (is.numeric(x)) replace(x, is.infinite(x), NA) else x
})

metric_regression(zeno_fw_uniqueid_df, t25fw_log, log_delta_pix_h_rel_median_pose_zv)
## [1] "Data Frame:  zeno_fw_uniqueid_df"
## Warning: Removed 2 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.35233 -0.17374 -0.02114  0.13592  1.65013 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         1.06175    0.05603   18.95   <2e-16 ***
## log_delta_pix_h_rel_median_pose_zv -0.58389    0.04958  -11.78   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3115 on 148 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.4838, Adjusted R-squared:  0.4803 
## F-statistic: 138.7 on 1 and 148 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.11570 -0.12047 -0.01092  0.10797  1.37698 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.044096   0.137238   7.608
## log_delta_pix_h_rel_median_pose_zv            -0.498234   0.055946  -8.906
## demoEHR_Age                                    0.003640   0.002509   1.451
## demoEHR_DiseaseDuration                       -0.003502   0.003716  -0.942
## ms_dx_condensedProgressive MS                  0.236181   0.075157   3.143
## ms_dx_condensedMS, Subtype Not Specified       0.231689   0.313889   0.738
## race_ethnicity_cleanBlack Or African American -0.017933   0.130692  -0.137
## race_ethnicity_cleanHispanic or Latino        -0.134506   0.122976  -1.094
## race_ethnicity_cleanWhite Not Hispanic        -0.110564   0.099751  -1.108
## race_ethnicity_cleanOther/Unknown/Declined     0.031390   0.128366   0.245
## clean_sexMale                                 -0.008757   0.059583  -0.147
## clean_sexNon-Binary                           -0.092261   0.306123  -0.301
##                                               Pr(>|t|)    
## (Intercept)                                   3.92e-12 ***
## log_delta_pix_h_rel_median_pose_zv            2.74e-15 ***
## demoEHR_Age                                    0.14915    
## demoEHR_DiseaseDuration                        0.34763    
## ms_dx_condensedProgressive MS                  0.00205 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.46169    
## race_ethnicity_cleanBlack Or African American  0.89106    
## race_ethnicity_cleanHispanic or Latino         0.27597    
## race_ethnicity_cleanWhite Not Hispanic         0.26962    
## race_ethnicity_cleanOther/Unknown/Declined     0.80718    
## clean_sexMale                                  0.88337    
## clean_sexNon-Binary                            0.76357    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.302 on 138 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.5476, Adjusted R-squared:  0.5115 
## F-statistic: 15.18 on 11 and 138 DF,  p-value: < 2.2e-16

Univariate - FW, stride time –> T25fw

sum(is.finite(zeno_fw_df$stride_time_mean_sec_pose_zv))
## [1] 163
metric_regression(zeno_fw_df, t25fw_log, stride_time_median_sec_pose_zv)
## [1] "Data Frame:  zeno_fw_df"
## Warning: Removed 51 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.73060 -0.18730 -0.04261  0.12506  1.92101 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.2280     0.1508   1.512    0.133    
## stride_time_median_sec_pose_zv   1.4712     0.1574   9.348   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3402 on 161 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.3518, Adjusted R-squared:  0.3478 
## F-statistic: 87.38 on 1 and 161 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ stride_time_median_sec_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.64025 -0.15865 -0.03891  0.11763  1.59607 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.213514   0.206204   1.035
## stride_time_median_sec_pose_zv                 1.218923   0.161245   7.559
## demoEHR_Age                                    0.006493   0.002614   2.484
## demoEHR_DiseaseDuration                        0.002095   0.003583   0.585
## ms_dx_condensedProgressive MS                  0.197327   0.082560   2.390
## ms_dx_condensedMS, Subtype Not Specified       0.227910   0.324963   0.701
## race_ethnicity_cleanBlack Or African American  0.213650   0.128212   1.666
## race_ethnicity_cleanHispanic or Latino        -0.033581   0.119039  -0.282
## race_ethnicity_cleanWhite Not Hispanic        -0.158871   0.097574  -1.628
## race_ethnicity_cleanOther/Unknown/Declined    -0.080149   0.127595  -0.628
## clean_sexMale                                 -0.089532   0.058921  -1.520
## clean_sexNon-Binary                            0.045792   0.228002   0.201
##                                               Pr(>|t|)    
## (Intercept)                                     0.3021    
## stride_time_median_sec_pose_zv                3.64e-12 ***
## demoEHR_Age                                     0.0141 *  
## demoEHR_DiseaseDuration                         0.5597    
## ms_dx_condensedProgressive MS                   0.0181 *  
## ms_dx_condensedMS, Subtype Not Specified        0.4842    
## race_ethnicity_cleanBlack Or African American   0.0977 .  
## race_ethnicity_cleanHispanic or Latino          0.7783    
## race_ethnicity_cleanWhite Not Hispanic          0.1056    
## race_ethnicity_cleanOther/Unknown/Declined      0.5309    
## clean_sexMale                                   0.1307    
## clean_sexNon-Binary                             0.8411    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3145 on 151 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.4807, Adjusted R-squared:  0.4429 
## F-statistic: 12.71 on 11 and 151 DF,  p-value: < 2.2e-16

# true fast walk - stride time from mat 
metric_regression(zeno_fw_df, t25fw_log, FW_stridetimesecmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ FW_stridetimesecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57048 -0.16524 -0.01128  0.15425  0.82409 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.20303    0.06827   2.974  0.00328 ** 
## FW_stridetimesecmean  1.42136    0.06568  21.642  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2492 on 212 degrees of freedom
## Multiple R-squared:  0.6884, Adjusted R-squared:  0.6869 
## F-statistic: 468.4 on 1 and 212 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ FW_stridetimesecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.49823 -0.13689 -0.00533  0.12817  0.82342 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.171658   0.106602   1.610
## FW_stridetimesecmean                           1.337358   0.070935  18.853
## demoEHR_Age                                    0.004395   0.001753   2.507
## demoEHR_DiseaseDuration                        0.003300   0.002341   1.409
## ms_dx_condensedProgressive MS                  0.067288   0.051507   1.306
## ms_dx_condensedMS, Subtype Not Specified       0.249682   0.240099   1.040
## race_ethnicity_cleanBlack Or African American  0.019617   0.087728   0.224
## race_ethnicity_cleanHispanic or Latino        -0.124437   0.080182  -1.552
## race_ethnicity_cleanWhite Not Hispanic        -0.164024   0.064764  -2.533
## race_ethnicity_cleanOther/Unknown/Declined    -0.083115   0.081160  -1.024
## clean_sexMale                                 -0.083589   0.039503  -2.116
## clean_sexNon-Binary                            0.064060   0.168219   0.381
##                                               Pr(>|t|)    
## (Intercept)                                     0.1089    
## FW_stridetimesecmean                            <2e-16 ***
## demoEHR_Age                                     0.0129 *  
## demoEHR_DiseaseDuration                         0.1603    
## ms_dx_condensedProgressive MS                   0.1929    
## ms_dx_condensedMS, Subtype Not Specified        0.2996    
## race_ethnicity_cleanBlack Or African American   0.8233    
## race_ethnicity_cleanHispanic or Latino          0.1222    
## race_ethnicity_cleanWhite Not Hispanic          0.0121 *  
## race_ethnicity_cleanOther/Unknown/Declined      0.3070    
## clean_sexMale                                   0.0356 *  
## clean_sexNon-Binary                             0.7037    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2337 on 202 degrees of freedom
## Multiple R-squared:  0.739,  Adjusted R-squared:  0.7248 
## F-statistic: 51.99 on 11 and 202 DF,  p-value: < 2.2e-16

# video unique IDs
metric_regression(zeno_fw_uniqueid_df, t25fw_log, FW_stridetimesecmean)
## [1] "Data Frame:  zeno_fw_uniqueid_df"

## [1] "t25fw_log ~ FW_stridetimesecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.54712 -0.16589 -0.01593  0.15256  0.81779 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.20066    0.09182   2.185   0.0304 *  
## FW_stridetimesecmean  1.42891    0.08830  16.182   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2604 on 150 degrees of freedom
## Multiple R-squared:  0.6358, Adjusted R-squared:  0.6334 
## F-statistic: 261.9 on 1 and 150 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ FW_stridetimesecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50379 -0.13670 -0.01517  0.14663  0.82463 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.162934   0.136741   1.192
## FW_stridetimesecmean                           1.339424   0.094838  14.123
## demoEHR_Age                                    0.004710   0.001989   2.367
## demoEHR_DiseaseDuration                        0.004681   0.002972   1.575
## ms_dx_condensedProgressive MS                  0.094059   0.062420   1.507
## ms_dx_condensedMS, Subtype Not Specified      -0.179475   0.177031  -1.014
## race_ethnicity_cleanBlack Or African American -0.033107   0.104768  -0.316
## race_ethnicity_cleanHispanic or Latino        -0.164976   0.097217  -1.697
## race_ethnicity_cleanWhite Not Hispanic        -0.180499   0.079757  -2.263
## race_ethnicity_cleanOther/Unknown/Declined    -0.082786   0.102405  -0.808
## clean_sexMale                                 -0.075163   0.047209  -1.592
## clean_sexNon-Binary                            0.013783   0.245312   0.056
##                                               Pr(>|t|)    
## (Intercept)                                     0.2355    
## FW_stridetimesecmean                            <2e-16 ***
## demoEHR_Age                                     0.0193 *  
## demoEHR_DiseaseDuration                         0.1174    
## ms_dx_condensedProgressive MS                   0.1341    
## ms_dx_condensedMS, Subtype Not Specified        0.3124    
## race_ethnicity_cleanBlack Or African American   0.7525    
## race_ethnicity_cleanHispanic or Latino          0.0919 .  
## race_ethnicity_cleanWhite Not Hispanic          0.0252 *  
## race_ethnicity_cleanOther/Unknown/Declined      0.4202    
## clean_sexMale                                   0.1136    
## clean_sexNon-Binary                             0.9553    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2422 on 140 degrees of freedom
## Multiple R-squared:  0.706,  Adjusted R-squared:  0.6829 
## F-statistic: 30.57 on 11 and 140 DF,  p-value: < 2.2e-16

Univariate - FW, cadence–> T25fw

#FWS 
sum(is.finite(zeno_fw_df$mean_cadence_step_per_min_pose_zv))
## [1] 170
# cadence model 
metric_regression(zeno_fw_df, t25fw_log, mean_cadence_step_per_min_pose_zv)
## [1] "Data Frame:  zeno_fw_df"
## Warning: Removed 44 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.07674 -0.20136 -0.04297  0.16803  1.88356 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.998170   0.163617  18.324  < 2e-16 ***
## mean_cadence_step_per_min_pose_zv -0.011313   0.001342  -8.431 1.49e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3908 on 168 degrees of freedom
##   (44 observations deleted due to missingness)
## Multiple R-squared:  0.2973, Adjusted R-squared:  0.2931 
## F-statistic: 71.09 on 1 and 168 DF,  p-value: 1.491e-14

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.84863 -0.19022 -0.03352  0.14524  1.55267 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    2.412344   0.207150  11.645
## mean_cadence_step_per_min_pose_zv             -0.008895   0.001279  -6.956
## demoEHR_Age                                    0.007766   0.002838   2.736
## demoEHR_DiseaseDuration                       -0.001864   0.003841  -0.485
## ms_dx_condensedProgressive MS                  0.362424   0.084484   4.290
## ms_dx_condensedMS, Subtype Not Specified       0.365477   0.357713   1.022
## race_ethnicity_cleanBlack Or African American  0.260124   0.140827   1.847
## race_ethnicity_cleanHispanic or Latino        -0.030042   0.129058  -0.233
## race_ethnicity_cleanWhite Not Hispanic        -0.163962   0.106890  -1.534
## race_ethnicity_cleanOther/Unknown/Declined    -0.076245   0.140441  -0.543
## clean_sexMale                                 -0.125360   0.064172  -1.953
## clean_sexNon-Binary                            0.101057   0.251071   0.403
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## mean_cadence_step_per_min_pose_zv             8.74e-11 ***
## demoEHR_Age                                    0.00693 ** 
## demoEHR_DiseaseDuration                        0.62812    
## ms_dx_condensedProgressive MS                 3.10e-05 ***
## ms_dx_condensedMS, Subtype Not Specified       0.30848    
## race_ethnicity_cleanBlack Or African American  0.06660 .  
## race_ethnicity_cleanHispanic or Latino         0.81623    
## race_ethnicity_cleanWhite Not Hispanic         0.12705    
## race_ethnicity_cleanOther/Unknown/Declined     0.58797    
## clean_sexMale                                  0.05253 .  
## clean_sexNon-Binary                            0.68786    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3462 on 158 degrees of freedom
##   (44 observations deleted due to missingness)
## Multiple R-squared:  0.4815, Adjusted R-squared:  0.4454 
## F-statistic: 13.34 on 11 and 158 DF,  p-value: < 2.2e-16

# ground truth cadence from mat 
metric_regression(zeno_fw_df, t25fw_log, FW_cadencestepsminmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ FW_cadencestepsminmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.60589 -0.17693 -0.03551  0.14525  1.39089 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             3.3846730  0.1149938   29.43   <2e-16 ***
## FW_cadencestepsminmean -0.0141112  0.0009113  -15.48   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3058 on 212 degrees of freedom
## Multiple R-squared:  0.5307, Adjusted R-squared:  0.5285 
## F-statistic: 239.8 on 1 and 212 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ FW_cadencestepsminmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.65963 -0.19051 -0.02547  0.14472  1.21522 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    3.0470306  0.1715600  17.761
## FW_cadencestepsminmean                        -0.0124672  0.0009762 -12.771
## demoEHR_Age                                    0.0037984  0.0021767   1.745
## demoEHR_DiseaseDuration                        0.0025454  0.0029013   0.877
## ms_dx_condensedProgressive MS                  0.1796295  0.0622120   2.887
## ms_dx_condensedMS, Subtype Not Specified       0.3143551  0.2967606   1.059
## race_ethnicity_cleanBlack Or African American  0.0692572  0.1082362   0.640
## race_ethnicity_cleanHispanic or Latino        -0.0507755  0.0989808  -0.513
## race_ethnicity_cleanWhite Not Hispanic        -0.1200663  0.0800796  -1.499
## race_ethnicity_cleanOther/Unknown/Declined    -0.0657912  0.1002991  -0.656
## clean_sexMale                                 -0.1084007  0.0489306  -2.215
## clean_sexNon-Binary                            0.0108231  0.2078188   0.052
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## FW_cadencestepsminmean                         < 2e-16 ***
## demoEHR_Age                                    0.08250 .  
## demoEHR_DiseaseDuration                        0.38136    
## ms_dx_condensedProgressive MS                  0.00431 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.29073    
## race_ethnicity_cleanBlack Or African American  0.52298    
## race_ethnicity_cleanHispanic or Latino         0.60852    
## race_ethnicity_cleanWhite Not Hispanic         0.13535    
## race_ethnicity_cleanOther/Unknown/Declined     0.51260    
## clean_sexMale                                  0.02785 *  
## clean_sexNon-Binary                            0.95852    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2887 on 202 degrees of freedom
## Multiple R-squared:  0.6015, Adjusted R-squared:  0.5798 
## F-statistic: 27.72 on 11 and 202 DF,  p-value: < 2.2e-16

# unique IDs 
metric_regression(zeno_fw_uniqueid_df, t25fw_log, mean_cadence_step_per_min_pose_zv)
## [1] "Data Frame:  zeno_fw_uniqueid_df"
## Warning: Removed 38 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9717 -0.2306 -0.0546  0.1739  1.6470 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.842617   0.196824  14.442  < 2e-16 ***
## mean_cadence_step_per_min_pose_zv -0.010079   0.001656  -6.086 1.65e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3976 on 112 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.2485, Adjusted R-squared:  0.2418 
## F-statistic: 37.04 on 1 and 112 DF,  p-value: 1.654e-08

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.72354 -0.21376 -0.03584  0.15569  1.35513 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    2.281242   0.258885   8.812
## mean_cadence_step_per_min_pose_zv             -0.007361   0.001634  -4.505
## demoEHR_Age                                    0.007930   0.003230   2.455
## demoEHR_DiseaseDuration                       -0.001300   0.004870  -0.267
## ms_dx_condensedProgressive MS                  0.398632   0.104676   3.808
## ms_dx_condensedMS, Subtype Not Specified       0.023236   0.261059   0.089
## race_ethnicity_cleanBlack Or African American  0.113740   0.173867   0.654
## race_ethnicity_cleanHispanic or Latino        -0.071318   0.163091  -0.437
## race_ethnicity_cleanWhite Not Hispanic        -0.262139   0.136289  -1.923
## race_ethnicity_cleanOther/Unknown/Declined    -0.151719   0.186778  -0.812
## clean_sexMale                                 -0.087965   0.077644  -1.133
## clean_sexNon-Binary                            0.051987   0.361983   0.144
##                                               Pr(>|t|)    
## (Intercept)                                   3.44e-14 ***
## mean_cadence_step_per_min_pose_zv             1.77e-05 ***
## demoEHR_Age                                   0.015760 *  
## demoEHR_DiseaseDuration                       0.789963    
## ms_dx_condensedProgressive MS                 0.000239 ***
## ms_dx_condensedMS, Subtype Not Specified      0.929251    
## race_ethnicity_cleanBlack Or African American 0.514472    
## race_ethnicity_cleanHispanic or Latino        0.662825    
## race_ethnicity_cleanWhite Not Hispanic        0.057218 .  
## race_ethnicity_cleanOther/Unknown/Declined    0.418513    
## clean_sexMale                                 0.259900    
## clean_sexNon-Binary                           0.886087    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3553 on 102 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.4537, Adjusted R-squared:  0.3948 
## F-statistic:   7.7 on 11 and 102 DF,  p-value: 1.51e-09

Univariate - FW, stride width–> T25fw

# Fast Walking Speed 
sum(is.finite(zeno_fw_df$stride_width_mean_cm_pose_zv))
## [1] 169
## model  
metric_regression(zeno_fw_df, t25fw_log, stride_width_median_cm_pose_zv)
## [1] "Data Frame:  zeno_fw_df"
## Warning: Removed 45 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68230 -0.24335 -0.09593  0.09710  2.33305 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     1.27803    0.15463   8.265 4.14e-14 ***
## stride_width_median_cm_pose_zv  0.03012    0.01254   2.403   0.0174 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4588 on 167 degrees of freedom
##   (45 observations deleted due to missingness)
## Multiple R-squared:  0.03341,    Adjusted R-squared:  0.02762 
## F-statistic: 5.772 on 1 and 167 DF,  p-value: 0.01738

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.73201 -0.21750 -0.04661  0.12130  1.71544 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.188740   0.224546   5.294
## stride_width_median_cm_pose_zv                 0.014262   0.011550   1.235
## demoEHR_Age                                    0.008147   0.003227   2.525
## demoEHR_DiseaseDuration                       -0.004876   0.004376  -1.114
## ms_dx_condensedProgressive MS                  0.538666   0.091816   5.867
## ms_dx_condensedMS, Subtype Not Specified       0.236494   0.406830   0.581
## race_ethnicity_cleanBlack Or African American  0.267262   0.160062   1.670
## race_ethnicity_cleanHispanic or Latino        -0.091687   0.148082  -0.619
## race_ethnicity_cleanWhite Not Hispanic        -0.194807   0.123103  -1.582
## race_ethnicity_cleanOther/Unknown/Declined    -0.096982   0.162721  -0.596
## clean_sexMale                                 -0.128876   0.073409  -1.756
## clean_sexNon-Binary                           -0.015069   0.285596  -0.053
##                                               Pr(>|t|)    
## (Intercept)                                   3.97e-07 ***
## stride_width_median_cm_pose_zv                  0.2187    
## demoEHR_Age                                     0.0126 *  
## demoEHR_DiseaseDuration                         0.2669    
## ms_dx_condensedProgressive MS                 2.55e-08 ***
## ms_dx_condensedMS, Subtype Not Specified        0.5619    
## race_ethnicity_cleanBlack Or African American   0.0970 .  
## race_ethnicity_cleanHispanic or Latino          0.5367    
## race_ethnicity_cleanWhite Not Hispanic          0.1156    
## race_ethnicity_cleanOther/Unknown/Declined      0.5520    
## clean_sexMale                                   0.0811 .  
## clean_sexNon-Binary                             0.9580    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3933 on 157 degrees of freedom
##   (45 observations deleted due to missingness)
## Multiple R-squared:  0.3323, Adjusted R-squared:  0.2855 
## F-statistic: 7.103 on 11 and 157 DF,  p-value: 1.006e-09

## pressure mat stride width model  
metric_regression(zeno_fw_df, t25fw_log, FW_stridewidthcmmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ FW_stridewidthcmmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6943 -0.2283 -0.1038  0.1228  2.1932 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.20143    0.07999   15.02  < 2e-16 ***
## FW_stridewidthcmmean  0.04381    0.00758    5.78 2.65e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4149 on 212 degrees of freedom
## Multiple R-squared:  0.1361, Adjusted R-squared:  0.132 
## F-statistic:  33.4 on 1 and 212 DF,  p-value: 2.651e-08

## [1] "t25fw_log ~ FW_stridewidthcmmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.86562 -0.21225 -0.05185  0.14417  1.71516 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.903279   0.159311   5.670
## FW_stridewidthcmmean                           0.036545   0.007050   5.184
## demoEHR_Age                                    0.008181   0.002723   3.004
## demoEHR_DiseaseDuration                       -0.004739   0.003594  -1.319
## ms_dx_condensedProgressive MS                  0.411824   0.074046   5.562
## ms_dx_condensedMS, Subtype Not Specified       0.312724   0.375138   0.834
## race_ethnicity_cleanBlack Or African American  0.137154   0.136523   1.005
## race_ethnicity_cleanHispanic or Latino        -0.007251   0.125396  -0.058
## race_ethnicity_cleanWhite Not Hispanic        -0.074280   0.102369  -0.726
## race_ethnicity_cleanOther/Unknown/Declined    -0.011317   0.127545  -0.089
## clean_sexMale                                 -0.089020   0.061863  -1.439
## clean_sexNon-Binary                            0.020490   0.262506   0.078
##                                               Pr(>|t|)    
## (Intercept)                                   4.89e-08 ***
## FW_stridewidthcmmean                          5.26e-07 ***
## demoEHR_Age                                      0.003 ** 
## demoEHR_DiseaseDuration                          0.189    
## ms_dx_condensedProgressive MS                 8.40e-08 ***
## ms_dx_condensedMS, Subtype Not Specified         0.405    
## race_ethnicity_cleanBlack Or African American    0.316    
## race_ethnicity_cleanHispanic or Latino           0.954    
## race_ethnicity_cleanWhite Not Hispanic           0.469    
## race_ethnicity_cleanOther/Unknown/Declined       0.929    
## clean_sexMale                                    0.152    
## clean_sexNon-Binary                              0.938    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3647 on 202 degrees of freedom
## Multiple R-squared:  0.3642, Adjusted R-squared:  0.3296 
## F-statistic: 10.52 on 11 and 202 DF,  p-value: 3.516e-15

## unique IDs 
metric_regression(zeno_fw_uniqueid_df, t25fw_log, stride_width_median_cm_pose_zv)
## [1] "Data Frame:  zeno_fw_uniqueid_df"
## Warning: Removed 38 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5568 -0.2573 -0.0947  0.1019  2.1141 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     1.47875    0.17833   8.292 2.75e-13 ***
## stride_width_median_cm_pose_zv  0.01559    0.01439   1.083    0.281    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4563 on 112 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.01037,    Adjusted R-squared:  0.001535 
## F-statistic: 1.174 on 1 and 112 DF,  p-value: 0.281

## [1] "t25fw_log ~ stride_width_median_cm_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.90254 -0.22208 -0.03822  0.13187  1.50903 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.4609357  0.2642588   5.528
## stride_width_median_cm_pose_zv                -0.0008094  0.0132444  -0.061
## demoEHR_Age                                    0.0069604  0.0035288   1.972
## demoEHR_DiseaseDuration                       -0.0013514  0.0053694  -0.252
## ms_dx_condensedProgressive MS                  0.5878604  0.1062883   5.531
## ms_dx_condensedMS, Subtype Not Specified      -0.0330026  0.2878626  -0.115
## race_ethnicity_cleanBlack Or African American  0.1380764  0.1903464   0.725
## race_ethnicity_cleanHispanic or Latino        -0.1339586  0.1817699  -0.737
## race_ethnicity_cleanWhite Not Hispanic        -0.2676614  0.1517299  -1.764
## race_ethnicity_cleanOther/Unknown/Declined    -0.1772072  0.2075663  -0.854
## clean_sexMale                                 -0.0783511  0.0858632  -0.913
## clean_sexNon-Binary                            0.0018673  0.3981398   0.005
##                                               Pr(>|t|)    
## (Intercept)                                   2.50e-07 ***
## stride_width_median_cm_pose_zv                  0.9514    
## demoEHR_Age                                     0.0513 .  
## demoEHR_DiseaseDuration                         0.8018    
## ms_dx_condensedProgressive MS                 2.47e-07 ***
## ms_dx_condensedMS, Subtype Not Specified        0.9090    
## race_ethnicity_cleanBlack Or African American   0.4699    
## race_ethnicity_cleanHispanic or Latino          0.4628    
## race_ethnicity_cleanWhite Not Hispanic          0.0807 .  
## race_ethnicity_cleanOther/Unknown/Declined      0.3953    
## clean_sexMale                                   0.3637    
## clean_sexNon-Binary                             0.9963    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.389 on 102 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.345,  Adjusted R-squared:  0.2744 
## F-statistic: 4.884 on 11 and 102 DF,  p-value: 4.897e-06

Univariate - FW, Stance Time –> T25fw

Stance/swing/double/single support measures not calculated for all participants

# FW 
sum(is.finite(zeno_fw_df$foot1_stance_time_mean_pose_zv))
## [1] 31
#video model  
metric_regression(zeno_fw_df, t25fw_log, foot1_stance_time_mean_pose_zv)
## [1] "Data Frame:  zeno_fw_df"
## Warning: Removed 183 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.54928 -0.17667 -0.03690  0.07738  0.91980 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.9376     0.2347   3.995 0.000406 ***
## foot1_stance_time_mean_pose_zv   1.0468     0.3311   3.161 0.003663 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3083 on 29 degrees of freedom
##   (183 observations deleted due to missingness)
## Multiple R-squared:  0.2563, Adjusted R-squared:  0.2306 
## F-statistic: 9.993 on 1 and 29 DF,  p-value: 0.003663

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.33303 -0.13277 -0.03469  0.12341  0.73569 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.476510   0.391903   3.768
## foot1_stance_time_mean_pose_zv                 0.516747   0.358040   1.443
## demoEHR_Age                                   -0.010695   0.008343  -1.282
## demoEHR_DiseaseDuration                        0.014240   0.014096   1.010
## ms_dx_condensedProgressive MS                  0.509076   0.222935   2.284
## race_ethnicity_cleanBlack Or African American  0.624933   0.303581   2.059
## race_ethnicity_cleanHispanic or Latino         0.190468   0.209485   0.909
## race_ethnicity_cleanWhite Not Hispanic         0.066883   0.196828   0.340
## race_ethnicity_cleanOther/Unknown/Declined     0.539383   0.245188   2.200
## clean_sexMale                                 -0.065235   0.150037  -0.435
##                                               Pr(>|t|)   
## (Intercept)                                    0.00113 **
## foot1_stance_time_mean_pose_zv                 0.16370   
## demoEHR_Age                                    0.21382   
## demoEHR_DiseaseDuration                        0.32386   
## ms_dx_condensedProgressive MS                  0.03292 * 
## race_ethnicity_cleanBlack Or African American  0.05216 . 
## race_ethnicity_cleanHispanic or Latino         0.37355   
## race_ethnicity_cleanWhite Not Hispanic         0.73738   
## race_ethnicity_cleanOther/Unknown/Declined     0.03915 * 
## clean_sexMale                                  0.66815   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2663 on 21 degrees of freedom
##   (183 observations deleted due to missingness)
## Multiple R-squared:  0.5981, Adjusted R-squared:  0.4258 
## F-statistic: 3.472 on 9 and 21 DF,  p-value: 0.008969

# no pressure mat value 

# unique IDs 
metric_regression(zeno_fw_uniqueid_df, t25fw_log, foot1_stance_time_mean_pose_zv)
## [1] "Data Frame:  zeno_fw_uniqueid_df"
## Warning: Removed 135 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.45364 -0.15070 -0.04724  0.08034  0.87527 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                      0.8700     0.3596   2.420   0.0287 *
## foot1_stance_time_mean_pose_zv   1.1929     0.4799   2.485   0.0252 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3462 on 15 degrees of freedom
##   (135 observations deleted due to missingness)
## Multiple R-squared:  0.2917, Adjusted R-squared:  0.2445 
## F-statistic: 6.178 on 1 and 15 DF,  p-value: 0.02522

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.33986 -0.08339  0.00000  0.07865  0.51272 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.726126   0.750183   2.301
## foot1_stance_time_mean_pose_zv                -0.107262   0.737599  -0.145
## demoEHR_Age                                   -0.001685   0.013411  -0.126
## demoEHR_DiseaseDuration                       -0.004882   0.023913  -0.204
## ms_dx_condensedProgressive MS                  0.616849   0.345036   1.788
## race_ethnicity_cleanBlack Or African American  1.325559   0.525697   2.522
## race_ethnicity_cleanHispanic or Latino         0.326011   0.350369   0.930
## race_ethnicity_cleanWhite Not Hispanic         0.033550   0.345840   0.097
## race_ethnicity_cleanOther/Unknown/Declined     0.143184   0.452789   0.316
## clean_sexMale                                 -0.149444   0.185316  -0.806
##                                               Pr(>|t|)  
## (Intercept)                                     0.0549 .
## foot1_stance_time_mean_pose_zv                  0.8885  
## demoEHR_Age                                     0.9036  
## demoEHR_DiseaseDuration                         0.8440  
## ms_dx_condensedProgressive MS                   0.1170  
## race_ethnicity_cleanBlack Or African American   0.0397 *
## race_ethnicity_cleanHispanic or Latino          0.3831  
## race_ethnicity_cleanWhite Not Hispanic          0.9254  
## race_ethnicity_cleanOther/Unknown/Declined      0.7611  
## clean_sexMale                                   0.4465  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3045 on 7 degrees of freedom
##   (135 observations deleted due to missingness)
## Multiple R-squared:  0.7443, Adjusted R-squared:  0.4156 
## F-statistic: 2.264 on 9 and 7 DF,  p-value: 0.147

Univariate - FW, SWing Time –> T25fw

# FW  
sum(is.finite(zeno_fw_df$foot1_swing_time_mean_pose_zv))
## [1] 31
ggplot(data = zeno_fw_df, aes(x = foot1_swing_time_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 183 rows containing missing values (`geom_point()`).

ggplot(data = zeno_fw_df, aes(x = foot1_swing_per_mean_pose_zv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 183 rows containing missing values (`geom_point()`).

FW - remove outlier?? %, shouldn’t be greater than 100… ### Univariate - FW, Single and Double Support –> T25fw

# Fast Walking 
sum(is.finite(zeno_fw_df$foot1_term_double_support_time_mean_pose_zv))
## [1] 31
# try terminal double support time 
metric_regression(zeno_fw_df, t25fw_log, foot1_term_double_support_time_mean_pose_zv)
## [1] "Data Frame:  zeno_fw_df"
## Warning: Removed 183 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.48458 -0.12730 -0.03923  0.09861  0.68192 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                   1.3462     0.0804   16.74
## foot1_term_double_support_time_mean_pose_zv   1.9114     0.3957    4.83
##                                             Pr(>|t|)    
## (Intercept)                                  < 2e-16 ***
## foot1_term_double_support_time_mean_pose_zv 4.06e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2661 on 29 degrees of freedom
##   (183 observations deleted due to missingness)
## Multiple R-squared:  0.4458, Adjusted R-squared:  0.4267 
## F-statistic: 23.33 on 1 and 29 DF,  p-value: 4.065e-05

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.35764 -0.11927 -0.02492  0.10910  0.59988 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.527598   0.267627   5.708
## foot1_term_double_support_time_mean_pose_zv    1.360813   0.476985   2.853
## demoEHR_Age                                   -0.008067   0.007507  -1.074
## demoEHR_DiseaseDuration                        0.010679   0.012634   0.845
## ms_dx_condensedProgressive MS                  0.355741   0.205824   1.728
## race_ethnicity_cleanBlack Or African American  0.472928   0.277439   1.705
## race_ethnicity_cleanHispanic or Latino         0.213172   0.184110   1.158
## race_ethnicity_cleanWhite Not Hispanic         0.073562   0.173978   0.423
## race_ethnicity_cleanOther/Unknown/Declined     0.576028   0.218468   2.637
## clean_sexMale                                  0.044534   0.137062   0.325
##                                               Pr(>|t|)    
## (Intercept)                                   1.15e-05 ***
## foot1_term_double_support_time_mean_pose_zv    0.00953 ** 
## demoEHR_Age                                    0.29480    
## demoEHR_DiseaseDuration                        0.40746    
## ms_dx_condensedProgressive MS                  0.09860 .  
## race_ethnicity_cleanBlack Or African American  0.10302    
## race_ethnicity_cleanHispanic or Latino         0.25992    
## race_ethnicity_cleanWhite Not Hispanic         0.67672    
## race_ethnicity_cleanOther/Unknown/Declined     0.01542 *  
## clean_sexMale                                  0.74846    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2371 on 21 degrees of freedom
##   (183 observations deleted due to missingness)
## Multiple R-squared:  0.6816, Adjusted R-squared:  0.5452 
## F-statistic: 4.995 on 9 and 21 DF,  p-value: 0.00115

# unique IDs 
metric_regression(zeno_pws_uniqueid_df, t25fw_log, foot1_term_double_support_time_mean_pose_zv)
## [1] "Data Frame:  zeno_pws_uniqueid_df"
## Warning: Removed 122 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47957 -0.21192 -0.01916  0.19843  0.75915 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                  1.48305    0.08981  16.513
## foot1_term_double_support_time_mean_pose_zv  1.04515    0.32959   3.171
##                                             Pr(>|t|)    
## (Intercept)                                 5.77e-16 ***
## foot1_term_double_support_time_mean_pose_zv  0.00366 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2774 on 28 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.2642, Adjusted R-squared:  0.238 
## F-statistic: 10.06 on 1 and 28 DF,  p-value: 0.003664

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.29714 -0.19772 -0.03331  0.10630  0.63890 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.6517784  0.3007771   5.492
## foot1_term_double_support_time_mean_pose_zv    0.8110046  0.4014502   2.020
## demoEHR_Age                                   -0.0007846  0.0051959  -0.151
## demoEHR_DiseaseDuration                        0.0059087  0.0074536   0.793
## ms_dx_condensedProgressive MS                  0.1760955  0.1774567   0.992
## race_ethnicity_cleanBlack Or African American  0.2183771  0.2828617   0.772
## race_ethnicity_cleanHispanic or Latino        -0.1146077  0.2180385  -0.526
## race_ethnicity_cleanWhite Not Hispanic        -0.2338653  0.1967099  -1.189
## clean_sexMale                                 -0.0104773  0.1336019  -0.078
##                                               Pr(>|t|)    
## (Intercept)                                    1.9e-05 ***
## foot1_term_double_support_time_mean_pose_zv     0.0563 .  
## demoEHR_Age                                     0.8814    
## demoEHR_DiseaseDuration                         0.4368    
## ms_dx_condensedProgressive MS                   0.3323    
## race_ethnicity_cleanBlack Or African American   0.4487    
## race_ethnicity_cleanHispanic or Latino          0.6047    
## race_ethnicity_cleanWhite Not Hispanic          0.2478    
## clean_sexMale                                   0.9382    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2816 on 21 degrees of freedom
##   (122 observations deleted due to missingness)
## Multiple R-squared:  0.4315, Adjusted R-squared:  0.2149 
## F-statistic: 1.992 on 8 and 21 DF,  p-value: 0.09835

# mat double support 
metric_regression(zeno_fw_df, t25fw_log, FW_totaldsupportmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ FW_totaldsupportmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.75092 -0.26545 -0.10031  0.09632  2.28499 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1.626e+00  2.973e-02  54.698  < 2e-16 ***
## FW_totaldsupportmean 1.449e-05  4.085e-06   3.547  0.00048 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4337 on 212 degrees of freedom
## Multiple R-squared:  0.05601,    Adjusted R-squared:  0.05155 
## F-statistic: 12.58 on 1 and 212 DF,  p-value: 0.0004804

## [1] "t25fw_log ~ FW_totaldsupportmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.01867 -0.21125 -0.05201  0.12558  1.81766 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.354e+00  1.418e-01   9.549
## FW_totaldsupportmean                           1.002e-05  3.659e-06   2.739
## demoEHR_Age                                    7.176e-03  2.852e-03   2.516
## demoEHR_DiseaseDuration                       -3.580e-03  3.778e-03  -0.947
## ms_dx_condensedProgressive MS                  4.391e-01  7.723e-02   5.686
## ms_dx_condensedMS, Subtype Not Specified       2.048e-01  3.917e-01   0.523
## race_ethnicity_cleanBlack Or African American  1.847e-01  1.424e-01   1.297
## race_ethnicity_cleanHispanic or Latino        -6.004e-02  1.307e-01  -0.459
## race_ethnicity_cleanWhite Not Hispanic        -1.622e-01  1.057e-01  -1.535
## race_ethnicity_cleanOther/Unknown/Declined    -9.178e-02  1.324e-01  -0.693
## clean_sexMale                                 -5.459e-02  6.445e-02  -0.847
## clean_sexNon-Binary                            1.435e-02  2.744e-01   0.052
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## FW_totaldsupportmean                           0.00672 ** 
## demoEHR_Age                                    0.01263 *  
## demoEHR_DiseaseDuration                        0.34452    
## ms_dx_condensedProgressive MS                 4.51e-08 ***
## ms_dx_condensedMS, Subtype Not Specified       0.60159    
## race_ethnicity_cleanBlack Or African American  0.19620    
## race_ethnicity_cleanHispanic or Latino         0.64639    
## race_ethnicity_cleanWhite Not Hispanic         0.12627    
## race_ethnicity_cleanOther/Unknown/Declined     0.48894    
## clean_sexMale                                  0.39799    
## clean_sexNon-Binary                            0.95833    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3811 on 202 degrees of freedom
## Multiple R-squared:  0.3055, Adjusted R-squared:  0.2676 
## F-statistic: 8.076 on 11 and 202 DF,  p-value: 1.235e-11

zeno_fw_df$log_FW_totaldsupportmean <- log(zeno_fw_df$FW_totaldsupportmean)
metric_regression(zeno_fw_df, t25fw_log, log_FW_totaldsupportmean)
## [1] "Data Frame:  zeno_fw_df"

## [1] "t25fw_log ~ log_FW_totaldsupportmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.81592 -0.20781 -0.05199  0.10341  1.91655 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                0.2990     0.1265   2.364    0.019 *  
## log_FW_totaldsupportmean   0.4034     0.0375  10.757   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3591 on 212 degrees of freedom
## Multiple R-squared:  0.3531, Adjusted R-squared:   0.35 
## F-statistic: 115.7 on 1 and 212 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ log_FW_totaldsupportmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.41703 -0.18370 -0.05231  0.13717  1.68433 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    0.4454946  0.1636201   2.723
## log_FW_totaldsupportmean                       0.3176662  0.0379110   8.379
## demoEHR_Age                                    0.0039960  0.0025350   1.576
## demoEHR_DiseaseDuration                       -0.0008363  0.0033274  -0.251
## ms_dx_condensedProgressive MS                  0.3163545  0.0695423   4.549
## ms_dx_condensedMS, Subtype Not Specified       0.1235777  0.3437682   0.359
## race_ethnicity_cleanBlack Or African American  0.1344477  0.1250645   1.075
## race_ethnicity_cleanHispanic or Latino        -0.0983261  0.1147326  -0.857
## race_ethnicity_cleanWhite Not Hispanic        -0.1336072  0.0927248  -1.441
## race_ethnicity_cleanOther/Unknown/Declined    -0.0841658  0.1161419  -0.725
## clean_sexMale                                 -0.0459628  0.0565304  -0.813
## clean_sexNon-Binary                            0.0438553  0.2407309   0.182
##                                               Pr(>|t|)    
## (Intercept)                                    0.00704 ** 
## log_FW_totaldsupportmean                      8.95e-15 ***
## demoEHR_Age                                    0.11651    
## demoEHR_DiseaseDuration                        0.80180    
## ms_dx_condensedProgressive MS                 9.28e-06 ***
## ms_dx_condensedMS, Subtype Not Specified       0.71961    
## race_ethnicity_cleanBlack Or African American  0.28365    
## race_ethnicity_cleanHispanic or Latino         0.39246    
## race_ethnicity_cleanWhite Not Hispanic         0.15116    
## race_ethnicity_cleanOther/Unknown/Declined     0.46949    
## clean_sexMale                                  0.41714    
## clean_sexNon-Binary                            0.85563    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3344 on 202 degrees of freedom
## Multiple R-squared:  0.4655, Adjusted R-squared:  0.4364 
## F-statistic: 15.99 on 11 and 202 DF,  p-value: < 2.2e-16

Multivariate - FW, Gait metrics only –> T25fw

Metrics only - not including double support/stance measures, too many missing. May include after improving code

# FW 
fw_t25fw_multivar_model <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                stride_time_median_sec_pose_zv + 
                                mean_cadence_step_per_min_pose_zv + 
                                stride_width_median_cm_pose_zv, 
                               data = zeno_fw_df)

summary(fw_t25fw_multivar_model)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv, data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74282 -0.16267 -0.02336  0.11850  1.43166 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         1.299713   0.382281   3.400 0.000854 ***
## log_delta_pix_h_rel_median_pose_zv -0.361306   0.051372  -7.033 5.76e-11 ***
## stride_time_median_sec_pose_zv      0.516821   0.207082   2.496 0.013597 *  
## mean_cadence_step_per_min_pose_zv  -0.004330   0.001756  -2.467 0.014707 *  
## stride_width_median_cm_pose_zv     -0.001622   0.008724  -0.186 0.852740    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2884 on 158 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.5429, Adjusted R-squared:  0.5313 
## F-statistic: 46.91 on 4 and 158 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model))

fw_t25fw_multivar_model_2 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv * 
                                stride_time_median_sec_pose_zv * 
                                mean_cadence_step_per_min_pose_zv * 
                                stride_width_median_cm_pose_zv, 
                               data = zeno_fw_df)

summary(fw_t25fw_multivar_model_2)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv * 
##     stride_time_median_sec_pose_zv * mean_cadence_step_per_min_pose_zv * 
##     stride_width_median_cm_pose_zv, data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.70277 -0.14274 -0.00954  0.13379  1.21479 
## 
## Coefficients:
##                                                                                                                                      Estimate
## (Intercept)                                                                                                                        -13.741585
## log_delta_pix_h_rel_median_pose_zv                                                                                                  -5.900066
## stride_time_median_sec_pose_zv                                                                                                      17.362875
## mean_cadence_step_per_min_pose_zv                                                                                                    0.113749
## stride_width_median_cm_pose_zv                                                                                                       1.245241
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    3.941885
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.028876
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                    -0.132176
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.462095
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                       -1.540419
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                    -0.010832
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 -0.010176
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    -0.479686
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 -0.003478
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.013381
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.003381
##                                                                                                                                    Std. Error
## (Intercept)                                                                                                                          6.782085
## log_delta_pix_h_rel_median_pose_zv                                                                                                   3.843556
## stride_time_median_sec_pose_zv                                                                                                       7.082843
## mean_cadence_step_per_min_pose_zv                                                                                                    0.051170
## stride_width_median_cm_pose_zv                                                                                                       0.589806
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    3.839776
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.035562
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                     0.057648
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.327849
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        0.611170
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                     0.004566
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  0.037112
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     0.319171
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  0.002879
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.005086
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.002929
##                                                                                                                                    t value
## (Intercept)                                                                                                                         -2.026
## log_delta_pix_h_rel_median_pose_zv                                                                                                  -1.535
## stride_time_median_sec_pose_zv                                                                                                       2.451
## mean_cadence_step_per_min_pose_zv                                                                                                    2.223
## stride_width_median_cm_pose_zv                                                                                                       2.111
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    1.027
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.812
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                    -2.293
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    1.409
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                       -2.520
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                    -2.372
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 -0.274
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    -1.503
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 -1.208
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      2.631
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   1.154
##                                                                                                                                    Pr(>|t|)
## (Intercept)                                                                                                                         0.04456
## log_delta_pix_h_rel_median_pose_zv                                                                                                  0.12692
## stride_time_median_sec_pose_zv                                                                                                      0.01540
## mean_cadence_step_per_min_pose_zv                                                                                                   0.02774
## stride_width_median_cm_pose_zv                                                                                                      0.03644
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                   0.30630
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                0.41811
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                    0.02328
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                   0.16081
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                       0.01279
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                    0.01898
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 0.78432
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    0.13501
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 0.22890
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                     0.00943
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv  0.25025
##                                                                                                                                      
## (Intercept)                                                                                                                        * 
## log_delta_pix_h_rel_median_pose_zv                                                                                                   
## stride_time_median_sec_pose_zv                                                                                                     * 
## mean_cadence_step_per_min_pose_zv                                                                                                  * 
## stride_width_median_cm_pose_zv                                                                                                     * 
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                   * 
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                      * 
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                   * 
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                    **
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2594 on 147 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.6561, Adjusted R-squared:  0.621 
## F-statistic: 18.69 on 15 and 147 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model_2))

Multivariate - FW, Gait metrics + disease + demographics –> T25fw

# FW 
# add MS subtype 
fw_t25fw_multivar_model_3 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed, 
                                data = zeno_fw_df) 

summary(fw_t25fw_multivar_model_3)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed, data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.72744 -0.16550 -0.01536  0.11962  1.30768 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.353083   0.378232   3.577 0.000463
## log_delta_pix_h_rel_median_pose_zv       -0.348079   0.051143  -6.806 2.03e-10
## stride_time_median_sec_pose_zv            0.445776   0.207016   2.153 0.032828
## mean_cadence_step_per_min_pose_zv        -0.004189   0.001739  -2.409 0.017166
## stride_width_median_cm_pose_zv           -0.002735   0.008655  -0.316 0.752408
## ms_dx_condensedProgressive MS             0.153806   0.069690   2.207 0.028776
## ms_dx_condensedMS, Subtype Not Specified  0.318720   0.287672   1.108 0.269598
##                                             
## (Intercept)                              ***
## log_delta_pix_h_rel_median_pose_zv       ***
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        *  
## stride_width_median_cm_pose_zv              
## ms_dx_condensedProgressive MS            *  
## ms_dx_condensedMS, Subtype Not Specified    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2848 on 156 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.5599, Adjusted R-squared:  0.543 
## F-statistic: 33.08 on 6 and 156 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model_3))

# add age 
fw_t25fw_multivar_model_4 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age, 
                                data = zeno_fw_df) 

summary(fw_t25fw_multivar_model_4)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age, 
##     data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71450 -0.15767 -0.01378  0.14518  1.26586 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.090498   0.384480   2.836  0.00517
## log_delta_pix_h_rel_median_pose_zv       -0.341129   0.050271  -6.786  2.3e-10
## stride_time_median_sec_pose_zv            0.480248   0.203628   2.358  0.01960
## mean_cadence_step_per_min_pose_zv        -0.004205   0.001707  -2.464  0.01485
## stride_width_median_cm_pose_zv           -0.002871   0.008496  -0.338  0.73585
## ms_dx_condensedProgressive MS             0.091722   0.072372   1.267  0.20692
## ms_dx_condensedMS, Subtype Not Specified  0.226429   0.284551   0.796  0.42740
## demoEHR_Age                               0.005011   0.001907   2.628  0.00945
##                                             
## (Intercept)                              ** 
## log_delta_pix_h_rel_median_pose_zv       ***
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        *  
## stride_width_median_cm_pose_zv              
## ms_dx_condensedProgressive MS               
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                              ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2796 on 155 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.5787, Adjusted R-squared:  0.5597 
## F-statistic: 30.41 on 7 and 155 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model_4))

# add disease duration 
fw_t25fw_multivar_model_5 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration, 
                                data = zeno_fw_df) 

summary(fw_t25fw_multivar_model_5)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration, data = zeno_fw_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.70918 -0.16482 -0.01377  0.14354  1.27584 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.0970471  0.3861850   2.841  0.00511
## log_delta_pix_h_rel_median_pose_zv       -0.3400840  0.0505308  -6.730 3.15e-10
## stride_time_median_sec_pose_zv            0.4862678  0.2051473   2.370  0.01901
## mean_cadence_step_per_min_pose_zv        -0.0042238  0.0017130  -2.466  0.01477
## stride_width_median_cm_pose_zv           -0.0031944  0.0085843  -0.372  0.71032
## ms_dx_condensedProgressive MS             0.0894619  0.0729496   1.226  0.22194
## ms_dx_condensedMS, Subtype Not Specified  0.2155000  0.2875580   0.749  0.45475
## demoEHR_Age                               0.0047091  0.0021461   2.194  0.02972
## demoEHR_DiseaseDuration                   0.0009894  0.0031941   0.310  0.75717
##                                             
## (Intercept)                              ** 
## log_delta_pix_h_rel_median_pose_zv       ***
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        *  
## stride_width_median_cm_pose_zv              
## ms_dx_condensedProgressive MS               
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                              *  
## demoEHR_DiseaseDuration                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2804 on 154 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.5789, Adjusted R-squared:  0.5571 
## F-statistic: 26.47 on 8 and 154 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model_5))

# add race and ethnicity 
fw_t25fw_multivar_model_6 <- lm(t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration + 
                                 race_ethnicity_clean, 
                                data = zeno_fw_df) 

summary(fw_t25fw_multivar_model_6)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = zeno_fw_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6837 -0.1508 -0.0069  0.1173  1.2468 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.2620082  0.3798622   3.322
## log_delta_pix_h_rel_median_pose_zv            -0.3244476  0.0502294  -6.459
## stride_time_median_sec_pose_zv                 0.4355788  0.1990289   2.189
## mean_cadence_step_per_min_pose_zv             -0.0041332  0.0016762  -2.466
## stride_width_median_cm_pose_zv                -0.0095527  0.0086793  -1.101
## ms_dx_condensedProgressive MS                  0.1185009  0.0715211   1.657
## ms_dx_condensedMS, Subtype Not Specified       0.2510128  0.2783538   0.902
## demoEHR_Age                                    0.0056524  0.0022504   2.512
## demoEHR_DiseaseDuration                        0.0009945  0.0030963   0.321
## race_ethnicity_cleanBlack Or African American  0.1921663  0.1108580   1.733
## race_ethnicity_cleanHispanic or Latino        -0.0770721  0.1052229  -0.732
## race_ethnicity_cleanWhite Not Hispanic        -0.1256500  0.0852231  -1.474
## race_ethnicity_cleanOther/Unknown/Declined    -0.1115388  0.1127321  -0.989
##                                               Pr(>|t|)    
## (Intercept)                                    0.00112 ** 
## log_delta_pix_h_rel_median_pose_zv            1.38e-09 ***
## stride_time_median_sec_pose_zv                 0.03018 *  
## mean_cadence_step_per_min_pose_zv              0.01480 *  
## stride_width_median_cm_pose_zv                 0.27282    
## ms_dx_condensedProgressive MS                  0.09964 .  
## ms_dx_condensedMS, Subtype Not Specified       0.36862    
## demoEHR_Age                                    0.01307 *  
## demoEHR_DiseaseDuration                        0.74851    
## race_ethnicity_cleanBlack Or African American  0.08507 .  
## race_ethnicity_cleanHispanic or Latino         0.46503    
## race_ethnicity_cleanWhite Not Hispanic         0.14248    
## race_ethnicity_cleanOther/Unknown/Declined     0.32405    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2712 on 150 degrees of freedom
##   (51 observations deleted due to missingness)
## Multiple R-squared:  0.6163, Adjusted R-squared:  0.5856 
## F-statistic: 20.07 on 12 and 150 DF,  p-value: < 2.2e-16
hist(resid(fw_t25fw_multivar_model_6))

Home Videos –> T25fw

Demographics and disease info

# Home Videos - all 

home_dem_model <- lm(t25fw_log ~ demoEHR_Age + 
                     demoEHR_DiseaseDuration + 
                     ms_dx_condensed + 
                     ms_dx_condensed + 
                     clean_sex,
                   data = home_df)

summary(home_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + ms_dx_condensed + clean_sex, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.60983 -0.15926 -0.04037  0.12917  1.04400 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.275621   0.179586   7.103 2.34e-09
## demoEHR_Age                               0.005050   0.003670   1.376   0.1743
## demoEHR_DiseaseDuration                   0.008190   0.005782   1.417   0.1621
## ms_dx_condensedProgressive MS             0.671223   0.132635   5.061 4.82e-06
## ms_dx_condensedMS, Subtype Not Specified -0.075133   0.186614  -0.403   0.6888
## clean_sexMale                            -0.268558   0.121983  -2.202   0.0318
## clean_sexNon-Binary                       0.060679   0.235474   0.258   0.7976
##                                             
## (Intercept)                              ***
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ms_dx_condensedProgressive MS            ***
## ms_dx_condensedMS, Subtype Not Specified    
## clean_sexMale                            *  
## clean_sexNon-Binary                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3129 on 56 degrees of freedom
## Multiple R-squared:  0.4408, Adjusted R-squared:  0.3809 
## F-statistic: 7.356 on 6 and 56 DF,  p-value: 7.893e-06
# check residuals 
hist(resid(home_dem_model))

# home right -------------------------
home_r_dem_model <- lm(t25fw_log ~ demoEHR_Age + 
                     demoEHR_DiseaseDuration + 
                     ms_dx_condensed + 
                     ms_dx_condensed + 
                     clean_sex,
                   data = home_r_df)

summary(home_r_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + ms_dx_condensed + clean_sex, data = home_r_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4843 -0.1668 -0.0488  0.1267  1.0279 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.293913   0.269057   4.809 6.11e-05
## demoEHR_Age                               0.005014   0.005572   0.900  0.37682
## demoEHR_DiseaseDuration                   0.008172   0.008676   0.942  0.35528
## ms_dx_condensedProgressive MS             0.595348   0.192915   3.086  0.00491
## ms_dx_condensedMS, Subtype Not Specified -0.057804   0.282222  -0.205  0.83937
## clean_sexMale                            -0.334210   0.176156  -1.897  0.06941
## clean_sexNon-Binary                       0.044067   0.356200   0.124  0.90253
##                                             
## (Intercept)                              ***
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ms_dx_condensedProgressive MS            ** 
## ms_dx_condensedMS, Subtype Not Specified    
## clean_sexMale                            .  
## clean_sexNon-Binary                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3363 on 25 degrees of freedom
## Multiple R-squared:  0.4234, Adjusted R-squared:  0.2851 
## F-statistic:  3.06 on 6 and 25 DF,  p-value: 0.02195
# check residuals 
hist(resid(home_r_dem_model))

# home left --------------------------
home_l_dem_model <- lm(t25fw_log ~ demoEHR_Age + 
                     demoEHR_DiseaseDuration + 
                     ms_dx_condensed + 
                     ms_dx_condensed + 
                     clean_sex,
                   data = home_l_df)

summary(home_l_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + ms_dx_condensed + clean_sex, data = home_l_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.54392 -0.14622 -0.02766  0.10132  1.05961 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.229119   0.269913   4.554 0.000129
## demoEHR_Age                               0.005402   0.005418   0.997 0.328671
## demoEHR_DiseaseDuration                   0.008811   0.008665   1.017 0.319359
## ms_dx_condensedProgressive MS             0.794469   0.208926   3.803 0.000866
## ms_dx_condensedMS, Subtype Not Specified -0.119648   0.277337  -0.431 0.670016
## clean_sexMale                            -0.156355   0.193958  -0.806 0.428085
## clean_sexNon-Binary                       0.091006   0.348708   0.261 0.796334
##                                             
## (Intercept)                              ***
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ms_dx_condensedProgressive MS            ***
## ms_dx_condensedMS, Subtype Not Specified    
## clean_sexMale                               
## clean_sexNon-Binary                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3257 on 24 degrees of freedom
## Multiple R-squared:  0.4807, Adjusted R-squared:  0.3508 
## F-statistic: 3.702 on 6 and 24 DF,  p-value: 0.00954
hist(resid(home_l_dem_model))

# home unique IDs ----------------
home_uniqueid_dem_model <- lm(t25fw_log ~ demoEHR_Age + 
                                demoEHR_DiseaseDuration + 
                                ms_dx_condensed + 
                                ms_dx_condensed + 
                                clean_sex,
                              data = home_uniqueid_df)

summary(home_uniqueid_dem_model)
## 
## Call:
## lm(formula = t25fw_log ~ demoEHR_Age + demoEHR_DiseaseDuration + 
##     ms_dx_condensed + ms_dx_condensed + clean_sex, data = home_uniqueid_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.49230 -0.16271 -0.02361  0.15094  0.99514 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               1.389490   0.303322   4.581 0.000132
## demoEHR_Age                               0.002890   0.006146   0.470 0.642626
## demoEHR_DiseaseDuration                   0.010047   0.009720   1.034 0.312052
## ms_dx_condensedProgressive MS             0.610104   0.201017   3.035 0.005884
## ms_dx_condensedMS, Subtype Not Specified -0.034291   0.296007  -0.116 0.908781
## clean_sexMale                            -0.353169   0.186145  -1.897 0.070416
## clean_sexNon-Binary                       0.046192   0.373275   0.124 0.902589
##                                             
## (Intercept)                              ***
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ms_dx_condensedProgressive MS            ** 
## ms_dx_condensedMS, Subtype Not Specified    
## clean_sexMale                            .  
## clean_sexNon-Binary                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3505 on 23 degrees of freedom
## Multiple R-squared:  0.4144, Adjusted R-squared:  0.2617 
## F-statistic: 2.713 on 6 and 23 DF,  p-value: 0.03847
hist(resid(home_uniqueid_dem_model))

Univariate - home, delta pixel proxy –> T25fw

# Home All 
sum(is.finite(home_df$delta_pix_h_rel_median_pose_hv))
## [1] 59
home_df$log_delta_pix_h_rel_median_pose_hv <-log(home_df$delta_pix_h_rel_median_pose_hv)
home_df$sqrt_delta_pix_h_rel_median_pose_hv <- sqrt(home_df$delta_pix_h_rel_median_pose_hv)

#log velproxy and log t25Fw
metric_regression(home_df, t25fw_log, log_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 4 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.78400 -0.20539 -0.05828  0.16045  0.91691 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         1.27346    0.11925  10.679 3.21e-15 ***
## log_delta_pix_h_rel_median_pose_hv -0.28294    0.08539  -3.314   0.0016 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3549 on 57 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.1615, Adjusted R-squared:  0.1468 
## F-statistic: 10.98 on 1 and 57 DF,  p-value: 0.001605

## [1] "t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57181 -0.09042 -0.00424  0.10968  0.44869 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.169304   0.222698   5.251
## log_delta_pix_h_rel_median_pose_hv            -0.051586   0.068883  -0.749
## demoEHR_Age                                    0.004044   0.003202   1.263
## demoEHR_DiseaseDuration                        0.001765   0.005570   0.317
## ms_dx_condensedProgressive MS                  0.645632   0.108032   5.976
## ms_dx_condensedMS, Subtype Not Specified       0.015761   0.147203   0.107
## race_ethnicity_cleanBlack Or African American  1.227113   0.293983   4.174
## race_ethnicity_cleanHispanic or Latino         0.281474   0.256663   1.097
## race_ethnicity_cleanWhite Not Hispanic         0.153563   0.152929   1.004
## race_ethnicity_cleanOther/Unknown/Declined    -0.019314   0.177220  -0.109
## clean_sexMale                                 -0.274163   0.103109  -2.659
## clean_sexNon-Binary                           -0.001714   0.182624  -0.009
##                                               Pr(>|t|)    
## (Intercept)                                   3.59e-06 ***
## log_delta_pix_h_rel_median_pose_hv            0.457657    
## demoEHR_Age                                   0.212797    
## demoEHR_DiseaseDuration                       0.752773    
## ms_dx_condensedProgressive MS                 2.92e-07 ***
## ms_dx_condensedMS, Subtype Not Specified      0.915187    
## race_ethnicity_cleanBlack Or African American 0.000128 ***
## race_ethnicity_cleanHispanic or Latino        0.278373    
## race_ethnicity_cleanWhite Not Hispanic        0.320450    
## race_ethnicity_cleanOther/Unknown/Declined    0.913679    
## clean_sexMale                                 0.010682 *  
## clean_sexNon-Binary                           0.992551    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2382 on 47 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.6884, Adjusted R-squared:  0.6155 
## F-statistic:  9.44 on 11 and 47 DF,  p-value: 1.178e-08

#sqrt velproxy and log t25fw 
metric_regression(home_df, t25fw_log, sqrt_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 4 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.66793 -0.21030 -0.05585  0.16013  0.87504 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           2.3898     0.2079  11.493  < 2e-16 ***
## sqrt_delta_pix_h_rel_median_pose_hv  -1.3869     0.3743  -3.705 0.000479 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3479 on 57 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.1941, Adjusted R-squared:   0.18 
## F-statistic: 13.73 on 1 and 57 DF,  p-value: 0.0004788

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57392 -0.09589 -0.00481  0.10940  0.44522 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.357612   0.233289   5.819
## sqrt_delta_pix_h_rel_median_pose_hv           -0.212217   0.321215  -0.661
## demoEHR_Age                                    0.003860   0.003183   1.213
## demoEHR_DiseaseDuration                        0.001979   0.005550   0.357
## ms_dx_condensedProgressive MS                  0.645544   0.109676   5.886
## ms_dx_condensedMS, Subtype Not Specified       0.017943   0.147869   0.121
## race_ethnicity_cleanBlack Or African American  1.227339   0.294783   4.164
## race_ethnicity_cleanHispanic or Latino         0.280188   0.257745   1.087
## race_ethnicity_cleanWhite Not Hispanic         0.154298   0.153533   1.005
## race_ethnicity_cleanOther/Unknown/Declined    -0.022284   0.177897  -0.125
## clean_sexMale                                 -0.273926   0.104859  -2.612
## clean_sexNon-Binary                           -0.003771   0.182804  -0.021
##                                               Pr(>|t|)    
## (Intercept)                                   5.04e-07 ***
## sqrt_delta_pix_h_rel_median_pose_hv           0.512048    
## demoEHR_Age                                   0.231237    
## demoEHR_DiseaseDuration                       0.722951    
## ms_dx_condensedProgressive MS                 4.00e-07 ***
## ms_dx_condensedMS, Subtype Not Specified      0.903937    
## race_ethnicity_cleanBlack Or African American 0.000133 ***
## race_ethnicity_cleanHispanic or Latino        0.282547    
## race_ethnicity_cleanWhite Not Hispanic        0.320051    
## race_ethnicity_cleanOther/Unknown/Declined    0.900851    
## clean_sexMale                                 0.012037 *  
## clean_sexNon-Binary                           0.983630    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2385 on 47 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.6876, Adjusted R-squared:  0.6145 
## F-statistic: 9.404 on 11 and 47 DF,  p-value: 1.247e-08

# benchmark - pressure mat velocity and log t25fw + demographics and disease 
metric_regression(home_df, t25fw_log, PWS_velocitycmsecmean)
## [1] "Data Frame:  home_df"

## [1] "t25fw_log ~ PWS_velocitycmsecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.49767 -0.15691 -0.00799  0.13544  0.42438 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            2.868933   0.111735   25.68   <2e-16 ***
## PWS_velocitycmsecmean -0.011502   0.001024  -11.23   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2289 on 61 degrees of freedom
## Multiple R-squared:  0.6742, Adjusted R-squared:  0.6688 
## F-statistic: 126.2 on 1 and 61 DF,  p-value: < 2.2e-16

## [1] "t25fw_log ~ PWS_velocitycmsecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.3553 -0.1075  0.0000  0.1532  0.2638 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    2.2197212  0.2141056  10.367
## PWS_velocitycmsecmean                         -0.0075819  0.0013909  -5.451
## demoEHR_Age                                    0.0059091  0.0024487   2.413
## demoEHR_DiseaseDuration                        0.0007665  0.0041924   0.183
## ms_dx_condensedProgressive MS                  0.3399369  0.1001482   3.394
## ms_dx_condensedMS, Subtype Not Specified      -0.0013667  0.1140008  -0.012
## race_ethnicity_cleanBlack Or African American  0.5810782  0.2099520   2.768
## race_ethnicity_cleanHispanic or Latino        -0.1704833  0.1985851  -0.858
## race_ethnicity_cleanWhite Not Hispanic        -0.1361809  0.1106516  -1.231
## race_ethnicity_cleanOther/Unknown/Declined    -0.1764417  0.1238810  -1.424
## clean_sexMale                                 -0.0219856  0.0906709  -0.242
## clean_sexNon-Binary                            0.1468681  0.1454026   1.010
##                                               Pr(>|t|)    
## (Intercept)                                   3.72e-14 ***
## PWS_velocitycmsecmean                         1.46e-06 ***
## demoEHR_Age                                    0.01944 *  
## demoEHR_DiseaseDuration                        0.85565    
## ms_dx_condensedProgressive MS                  0.00134 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.99048    
## race_ethnicity_cleanBlack Or African American  0.00785 ** 
## race_ethnicity_cleanHispanic or Latino         0.39464    
## race_ethnicity_cleanWhite Not Hispanic         0.22407    
## race_ethnicity_cleanOther/Unknown/Declined     0.16045    
## clean_sexMale                                  0.80938    
## clean_sexNon-Binary                            0.31723    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1861 on 51 degrees of freedom
## Multiple R-squared:  0.8198, Adjusted R-squared:  0.781 
## F-statistic:  21.1 on 11 and 51 DF,  p-value: 2.86e-15

# left turns only 
home_l_df$sqrt_delta_pix_h_rel_median_pose_hv <- sqrt(home_l_df$delta_pix_h_rel_median_pose_hv)

metric_regression(home_l_df, t25fw_log, sqrt_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 3 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68453 -0.19988 -0.07443  0.16788  0.86712 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           2.4121     0.3286   7.340 8.54e-08 ***
## sqrt_delta_pix_h_rel_median_pose_hv  -1.4200     0.6021  -2.358   0.0262 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3927 on 26 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.1762, Adjusted R-squared:  0.1445 
## F-statistic: 5.562 on 1 and 26 DF,  p-value: 0.02616

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.53351 -0.07381  0.00000  0.11497  0.49009 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.081223   0.395401   2.734
## sqrt_delta_pix_h_rel_median_pose_hv            0.018925   0.481819   0.039
## demoEHR_Age                                    0.003316   0.005097   0.651
## demoEHR_DiseaseDuration                        0.004821   0.009524   0.506
## ms_dx_condensedProgressive MS                  0.808109   0.179979   4.490
## ms_dx_condensedMS, Subtype Not Specified      -0.031370   0.229749  -0.137
## race_ethnicity_cleanBlack Or African American  1.391236   0.403058   3.452
## race_ethnicity_cleanHispanic or Latino         0.381638   0.425005   0.898
## race_ethnicity_cleanWhite Not Hispanic         0.276421   0.283458   0.975
## race_ethnicity_cleanOther/Unknown/Declined     0.086125   0.309694   0.278
## clean_sexMale                                 -0.187213   0.167330  -1.119
## clean_sexNon-Binary                            0.048441   0.283151   0.171
##                                               Pr(>|t|)    
## (Intercept)                                   0.014695 *  
## sqrt_delta_pix_h_rel_median_pose_hv           0.969154    
## demoEHR_Age                                   0.524592    
## demoEHR_DiseaseDuration                       0.619596    
## ms_dx_condensedProgressive MS                 0.000371 ***
## ms_dx_condensedMS, Subtype Not Specified      0.893097    
## race_ethnicity_cleanBlack Or African American 0.003282 ** 
## race_ethnicity_cleanHispanic or Latino        0.382520    
## race_ethnicity_cleanWhite Not Hispanic        0.343988    
## race_ethnicity_cleanOther/Unknown/Declined    0.784499    
## clean_sexMale                                 0.279730    
## clean_sexNon-Binary                           0.866308    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.258 on 16 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.7811, Adjusted R-squared:  0.6306 
## F-statistic:  5.19 on 11 and 16 DF,  p-value: 0.001624

# right turns only 
home_r_df$sqrt_delta_pix_h_rel_median_pose_hv <- sqrt(home_r_df$delta_pix_h_rel_median_pose_hv)

metric_regression(home_r_df, t25fw_log, sqrt_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 1 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50118 -0.23370 -0.04484  0.13452  0.87680 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           2.3641     0.2707   8.734 1.29e-09 ***
## sqrt_delta_pix_h_rel_median_pose_hv  -1.3483     0.4797  -2.811  0.00877 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3155 on 29 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.2141, Adjusted R-squared:  0.187 
## F-statistic:   7.9 on 1 and 29 DF,  p-value: 0.008769

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.45621 -0.10825 -0.00677  0.13491  0.46250 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.492417   0.372937   4.002
## sqrt_delta_pix_h_rel_median_pose_hv        -0.352309   0.587835  -0.599
## demoEHR_Age                                 0.003921   0.004984   0.787
## demoEHR_DiseaseDuration                     0.001737   0.008362   0.208
## ms_dx_condensedProgressive MS               0.547264   0.172796   3.167
## ms_dx_condensedMS, Subtype Not Specified    0.045149   0.235023   0.192
## race_ethnicity_cleanHispanic or Latino      0.240353   0.397192   0.605
## race_ethnicity_cleanWhite Not Hispanic      0.114290   0.220884   0.517
## race_ethnicity_cleanOther/Unknown/Declined -0.060355   0.267268  -0.226
## clean_sexMale                              -0.312761   0.172572  -1.812
## clean_sexNon-Binary                        -0.016070   0.292315  -0.055
##                                            Pr(>|t|)    
## (Intercept)                                0.000701 ***
## sqrt_delta_pix_h_rel_median_pose_hv        0.555680    
## demoEHR_Age                                0.440656    
## demoEHR_DiseaseDuration                    0.837514    
## ms_dx_condensedProgressive MS              0.004846 ** 
## ms_dx_condensedMS, Subtype Not Specified   0.849597    
## race_ethnicity_cleanHispanic or Latino     0.551897    
## race_ethnicity_cleanWhite Not Hispanic     0.610539    
## race_ethnicity_cleanOther/Unknown/Declined 0.823631    
## clean_sexMale                              0.084973 .  
## clean_sexNon-Binary                        0.956704    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2696 on 20 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6044, Adjusted R-squared:  0.4066 
## F-statistic: 3.056 on 10 and 20 DF,  p-value: 0.01605

# unique ids 
home_uniqueid_df$sqrt_delta_pix_h_rel_median_pose_hv <- sqrt(home_uniqueid_df$delta_pix_h_rel_median_pose_hv)

metric_regression(home_uniqueid_df, t25fw_log, sqrt_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_uniqueid_df"
## Warning: Removed 3 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.65663 -0.22264 -0.08274  0.17771  0.88134 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           2.3751     0.3422   6.940 2.83e-07 ***
## sqrt_delta_pix_h_rel_median_pose_hv  -1.3678     0.6446  -2.122   0.0439 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.403 on 25 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.1526, Adjusted R-squared:  0.1187 
## F-statistic: 4.503 on 1 and 25 DF,  p-value: 0.04393

## [1] "t25fw_log ~ sqrt_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.43106 -0.16370  0.00000  0.08888  0.43942 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                    1.1925813  0.4720607   2.526
## sqrt_delta_pix_h_rel_median_pose_hv           -0.0104783  0.5998545  -0.017
## demoEHR_Age                                    0.0009337  0.0063262   0.148
## demoEHR_DiseaseDuration                        0.0013203  0.0111778   0.118
## ms_dx_condensedProgressive MS                  0.6145986  0.1874931   3.278
## ms_dx_condensedMS, Subtype Not Specified       0.0869331  0.2715630   0.320
## race_ethnicity_cleanBlack Or African American  1.4833659  0.4822130   3.076
## race_ethnicity_cleanHispanic or Latino         0.5401662  0.5076093   1.064
## race_ethnicity_cleanWhite Not Hispanic         0.3902701  0.3404247   1.146
## race_ethnicity_cleanOther/Unknown/Declined     0.1543245  0.3601969   0.428
## clean_sexMale                                 -0.3916064  0.1857237  -2.109
## clean_sexNon-Binary                           -0.0516429  0.3329611  -0.155
##                                               Pr(>|t|)   
## (Intercept)                                    0.02326 * 
## sqrt_delta_pix_h_rel_median_pose_hv            0.98629   
## demoEHR_Age                                    0.88463   
## demoEHR_DiseaseDuration                        0.90754   
## ms_dx_condensedProgressive MS                  0.00508 **
## ms_dx_condensedMS, Subtype Not Specified       0.75329   
## race_ethnicity_cleanBlack Or African American  0.00768 **
## race_ethnicity_cleanHispanic or Latino         0.30410   
## race_ethnicity_cleanWhite Not Hispanic         0.26958   
## race_ethnicity_cleanOther/Unknown/Declined     0.67442   
## clean_sexMale                                  0.05221 . 
## clean_sexNon-Binary                            0.87881   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3051 on 15 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.7086, Adjusted R-squared:  0.4948 
## F-statistic: 3.315 on 11 and 15 DF,  p-value: 0.01673

Interesting - Vel pixel proxy seems not as good (in this version) in home vs in-person video. Maybe due to variability in recoridng set up at home? In this dataset, demographics seems to explain a lot of variance (maybe small sample size + outliers, even after log transform?)

To do: try again with eye to ankle distance, seemed a lot better in previous versions. Not sure why it’s gotten worse

Univariate - home, stride time –> T25fw

sum(is.finite(home_df$stride_time_median_sec_pose_hv))
## [1] 50
# Home Videos 
metric_regression(home_df, t25fw_log, stride_time_median_sec_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 13 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.45339 -0.22717  0.00424  0.15417  0.53730 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.3659     0.1853   1.974   0.0541 .  
## stride_time_median_sec_pose_hv   1.0717     0.1530   7.003 7.28e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2683 on 48 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.5053, Adjusted R-squared:  0.495 
## F-statistic: 49.04 on 1 and 48 DF,  p-value: 7.283e-09

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.37955 -0.12947 -0.02151  0.14532  0.41628 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.396759   0.332484   1.193
## stride_time_median_sec_pose_hv              0.595157   0.243878   2.440
## demoEHR_Age                                 0.004271   0.003243   1.317
## demoEHR_DiseaseDuration                     0.006188   0.005044   1.227
## ms_dx_condensedProgressive MS               0.374928   0.191185   1.961
## ms_dx_condensedMS, Subtype Not Specified   -0.123825   0.133685  -0.926
## race_ethnicity_cleanHispanic or Latino      0.331041   0.236839   1.398
## race_ethnicity_cleanWhite Not Hispanic      0.285537   0.162036   1.762
## race_ethnicity_cleanOther/Unknown/Declined  0.069780   0.167938   0.416
## clean_sexMale                              -0.200774   0.103586  -1.938
##                                            Pr(>|t|)  
## (Intercept)                                  0.2398  
## stride_time_median_sec_pose_hv               0.0192 *
## demoEHR_Age                                  0.1953  
## demoEHR_DiseaseDuration                      0.2271  
## ms_dx_condensedProgressive MS                0.0569 .
## ms_dx_condensedMS, Subtype Not Specified     0.3599  
## race_ethnicity_cleanHispanic or Latino       0.1699  
## race_ethnicity_cleanWhite Not Hispanic       0.0857 .
## race_ethnicity_cleanOther/Unknown/Declined   0.6800  
## clean_sexMale                                0.0597 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2052 on 40 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.7589, Adjusted R-squared:  0.7047 
## F-statistic: 13.99 on 9 and 40 DF,  p-value: 7.852e-10

# PWS from mat 
metric_regression(home_df, t25fw_log, PWS_stridetimesecmean)
## [1] "Data Frame:  home_df"

## [1] "t25fw_log ~ PWS_stridetimesecmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47935 -0.22220 -0.03848  0.19794  0.61522 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             0.4821     0.1288   3.745 0.000403 ***
## PWS_stridetimesecmean   0.9694     0.1029   9.419 1.67e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2559 on 61 degrees of freedom
## Multiple R-squared:  0.5926, Adjusted R-squared:  0.5859 
## F-statistic: 88.71 on 1 and 61 DF,  p-value: 1.673e-13

## [1] "t25fw_log ~ PWS_stridetimesecmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.41811 -0.10640  0.00000  0.09373  0.38535 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    0.240538   0.231232   1.040
## PWS_stridetimesecmean                          0.813542   0.140701   5.782
## demoEHR_Age                                    0.008951   0.002509   3.568
## demoEHR_DiseaseDuration                        0.004954   0.004142   1.196
## ms_dx_condensedProgressive MS                  0.042125   0.133611   0.315
## ms_dx_condensedMS, Subtype Not Specified      -0.126098   0.113740  -1.109
## race_ethnicity_cleanBlack Or African American  0.574502   0.203894   2.818
## race_ethnicity_cleanHispanic or Latino        -0.047537   0.188192  -0.253
## race_ethnicity_cleanWhite Not Hispanic        -0.070969   0.104978  -0.676
## race_ethnicity_cleanOther/Unknown/Declined    -0.177090   0.121111  -1.462
## clean_sexMale                                 -0.127546   0.079501  -1.604
## clean_sexNon-Binary                            0.099729   0.140663   0.709
##                                               Pr(>|t|)    
## (Intercept)                                   0.303134    
## PWS_stridetimesecmean                         4.49e-07 ***
## demoEHR_Age                                   0.000793 ***
## demoEHR_DiseaseDuration                       0.237224    
## ms_dx_condensedProgressive MS                 0.753833    
## ms_dx_condensedMS, Subtype Not Specified      0.272784    
## race_ethnicity_cleanBlack Or African American 0.006866 ** 
## race_ethnicity_cleanHispanic or Latino        0.801592    
## race_ethnicity_cleanWhite Not Hispanic        0.502070    
## race_ethnicity_cleanOther/Unknown/Declined    0.149818    
## clean_sexMale                                 0.114817    
## clean_sexNon-Binary                           0.481558    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.182 on 51 degrees of freedom
## Multiple R-squared:  0.8278, Adjusted R-squared:  0.7906 
## F-statistic: 22.28 on 11 and 51 DF,  p-value: 9.46e-16

# left only - video 
metric_regression(home_l_df, t25fw_log, stride_time_median_sec_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.44480 -0.19687  0.01752  0.13429  0.47149 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.3098     0.2449   1.265    0.219    
## stride_time_median_sec_pose_hv   1.1124     0.2013   5.527 1.28e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2568 on 23 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.5704, Adjusted R-squared:  0.5518 
## F-statistic: 30.54 on 1 and 23 DF,  p-value: 1.275e-05

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.22598 -0.11669 -0.05208  0.16436  0.37668 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                -0.152921   0.585934  -0.261
## stride_time_median_sec_pose_hv              1.032963   0.431706   2.393
## demoEHR_Age                                 0.005565   0.004749   1.172
## demoEHR_DiseaseDuration                     0.006353   0.007777   0.817
## ms_dx_condensedProgressive MS               0.023369   0.348729   0.067
## ms_dx_condensedMS, Subtype Not Specified   -0.219404   0.204168  -1.075
## race_ethnicity_cleanHispanic or Latino      0.297629   0.355074   0.838
## race_ethnicity_cleanWhite Not Hispanic      0.292543   0.240827   1.215
## race_ethnicity_cleanOther/Unknown/Declined  0.092405   0.257604   0.359
## clean_sexMale                              -0.233820   0.140859  -1.660
##                                            Pr(>|t|)  
## (Intercept)                                  0.7977  
## stride_time_median_sec_pose_hv               0.0303 *
## demoEHR_Age                                  0.2596  
## demoEHR_DiseaseDuration                      0.4268  
## ms_dx_condensedProgressive MS                0.9475  
## ms_dx_condensedMS, Subtype Not Specified     0.2995  
## race_ethnicity_cleanHispanic or Latino       0.4151  
## race_ethnicity_cleanWhite Not Hispanic       0.2432  
## race_ethnicity_cleanOther/Unknown/Declined   0.7248  
## clean_sexMale                                0.1177  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2162 on 15 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.8013, Adjusted R-squared:  0.6822 
## F-statistic: 6.723 on 9 and 15 DF,  p-value: 0.0006798

# right only - video 
metric_regression(home_r_df, t25fw_log, stride_time_median_sec_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 7 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.46165 -0.23398 -0.00483  0.14562  0.54980 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.4262     0.2903   1.468 0.155714    
## stride_time_median_sec_pose_hv   1.0271     0.2410   4.262 0.000293 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2897 on 23 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.4412, Adjusted R-squared:  0.4169 
## F-statistic: 18.16 on 1 and 23 DF,  p-value: 0.0002932

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4354 -0.1159 -0.0196  0.1278  0.4333 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.649731   0.512776   1.267
## stride_time_median_sec_pose_hv              0.368614   0.379722   0.971
## demoEHR_Age                                 0.004578   0.005865   0.781
## demoEHR_DiseaseDuration                     0.004793   0.008501   0.564
## ms_dx_condensedProgressive MS               0.542075   0.285735   1.897
## ms_dx_condensedMS, Subtype Not Specified   -0.102353   0.231086  -0.443
## race_ethnicity_cleanHispanic or Latino      0.344817   0.398923   0.864
## race_ethnicity_cleanWhite Not Hispanic      0.275847   0.274976   1.003
## race_ethnicity_cleanOther/Unknown/Declined  0.077020   0.279189   0.276
## clean_sexMale                              -0.154087   0.200237  -0.770
##                                            Pr(>|t|)  
## (Intercept)                                  0.2244  
## stride_time_median_sec_pose_hv               0.3471  
## demoEHR_Age                                  0.4472  
## demoEHR_DiseaseDuration                      0.5812  
## ms_dx_condensedProgressive MS                0.0772 .
## ms_dx_condensedMS, Subtype Not Specified     0.6641  
## race_ethnicity_cleanHispanic or Latino       0.4010  
## race_ethnicity_cleanWhite Not Hispanic       0.3317  
## race_ethnicity_cleanOther/Unknown/Declined   0.7864  
## clean_sexMale                                0.4535  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2449 on 15 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.7395, Adjusted R-squared:  0.5833 
## F-statistic: 4.732 on 9 and 15 DF,  p-value: 0.004091

# unique IDs - video 
metric_regression(home_uniqueid_df, t25fw_log, stride_time_median_sec_pose_hv)
## [1] "Data Frame:  home_uniqueid_df"
## Warning: Removed 8 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.44506 -0.21030  0.01718  0.17693  0.47123 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.2927     0.2651   1.104    0.283    
## stride_time_median_sec_pose_hv   1.1272     0.2147   5.250 3.88e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2681 on 20 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.5795, Adjusted R-squared:  0.5585 
## F-statistic: 27.57 on 1 and 20 DF,  p-value: 3.876e-05

## [1] "t25fw_log ~ stride_time_median_sec_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.23616 -0.10344 -0.06526  0.14159  0.34328 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                -0.470725   0.671174  -0.701
## stride_time_median_sec_pose_hv              1.272269   0.486587   2.615
## demoEHR_Age                                 0.007124   0.005516   1.291
## demoEHR_DiseaseDuration                     0.005249   0.008169   0.643
## ms_dx_condensedProgressive MS              -0.169488   0.388935  -0.436
## ms_dx_condensedMS, Subtype Not Specified   -0.273667   0.223933  -1.222
## race_ethnicity_cleanHispanic or Latino      0.274901   0.381617   0.720
## race_ethnicity_cleanWhite Not Hispanic      0.290239   0.260403   1.115
## race_ethnicity_cleanOther/Unknown/Declined  0.108746   0.266573   0.408
## clean_sexMale                              -0.240160   0.155160  -1.548
##                                            Pr(>|t|)  
## (Intercept)                                  0.4965  
## stride_time_median_sec_pose_hv               0.0226 *
## demoEHR_Age                                  0.2209  
## demoEHR_DiseaseDuration                      0.5326  
## ms_dx_condensedProgressive MS                0.6707  
## ms_dx_condensedMS, Subtype Not Specified     0.2451  
## race_ethnicity_cleanHispanic or Latino       0.4851  
## race_ethnicity_cleanWhite Not Hispanic       0.2869  
## race_ethnicity_cleanOther/Unknown/Declined   0.6905  
## clean_sexMale                                0.1476  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2258 on 12 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.8212, Adjusted R-squared:  0.6871 
## F-statistic: 6.123 on 9 and 12 DF,  p-value: 0.002479

Univariate - home, cadence –> T25fw

# Home Videos 
sum(is.finite(home_df$mean_cadence_step_per_min_pose_hv))
## [1] 51
# cadence model 
metric_regression(home_df, t25fw_log, mean_cadence_step_per_min_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 12 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.62314 -0.29204 -0.02755  0.21058  0.78453 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.655426   0.264010  10.058 1.66e-13 ***
## mean_cadence_step_per_min_pose_hv -0.010018   0.002537  -3.949 0.000251 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3317 on 49 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.2414, Adjusted R-squared:  0.226 
## F-statistic:  15.6 on 1 and 49 DF,  p-value: 0.0002509

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.51563 -0.09908 -0.02010  0.14415  0.42519 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.425855   0.287774   4.955
## mean_cadence_step_per_min_pose_hv          -0.002999   0.002054  -1.460
## demoEHR_Age                                 0.002676   0.003197   0.837
## demoEHR_DiseaseDuration                     0.006096   0.005122   1.190
## ms_dx_condensedProgressive MS               0.676573   0.122683   5.515
## ms_dx_condensedMS, Subtype Not Specified   -0.059394   0.133070  -0.446
## race_ethnicity_cleanHispanic or Latino      0.368590   0.244533   1.507
## race_ethnicity_cleanWhite Not Hispanic      0.317195   0.167575   1.893
## race_ethnicity_cleanOther/Unknown/Declined  0.078784   0.173942   0.453
## clean_sexMale                              -0.227672   0.098397  -2.314
##                                            Pr(>|t|)    
## (Intercept)                                1.30e-05 ***
## mean_cadence_step_per_min_pose_hv            0.1518    
## demoEHR_Age                                  0.4074    
## demoEHR_DiseaseDuration                      0.2409    
## ms_dx_condensedProgressive MS              2.11e-06 ***
## ms_dx_condensedMS, Subtype Not Specified     0.6577    
## race_ethnicity_cleanHispanic or Latino       0.1394    
## race_ethnicity_cleanWhite Not Hispanic       0.0655 .  
## race_ethnicity_cleanOther/Unknown/Declined   0.6530    
## clean_sexMale                                0.0258 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2126 on 41 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.7394, Adjusted R-squared:  0.6822 
## F-statistic: 12.92 on 9 and 41 DF,  p-value: 1.893e-09

# ground truth cadence from mat 
metric_regression(home_df, t25fw_log, PWS_cadencestepsminmean)
## [1] "Data Frame:  home_df"

## [1] "t25fw_log ~ PWS_cadencestepsminmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.54113 -0.22498 -0.00353  0.20685  0.57072 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              3.273424   0.205824  15.904  < 2e-16 ***
## PWS_cadencestepsminmean -0.015691   0.001967  -7.976 4.84e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2805 on 61 degrees of freedom
## Multiple R-squared:  0.5105, Adjusted R-squared:  0.5025 
## F-statistic: 63.61 on 1 and 61 DF,  p-value: 4.842e-11

## [1] "t25fw_log ~ PWS_cadencestepsminmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4340 -0.1191  0.0000  0.1292  0.3680 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    2.265792   0.294904   7.683
## PWS_cadencestepsminmean                       -0.009766   0.002617  -3.731
## demoEHR_Age                                    0.007335   0.002829   2.593
## demoEHR_DiseaseDuration                        0.006899   0.004896   1.409
## ms_dx_condensedProgressive MS                  0.288894   0.135298   2.135
## ms_dx_condensedMS, Subtype Not Specified      -0.097336   0.130032  -0.749
## race_ethnicity_cleanBlack Or African American  0.652933   0.244291   2.673
## race_ethnicity_cleanHispanic or Latino        -0.063416   0.219264  -0.289
## race_ethnicity_cleanWhite Not Hispanic        -0.064278   0.121292  -0.530
## race_ethnicity_cleanOther/Unknown/Declined    -0.197045   0.138981  -1.418
## clean_sexMale                                 -0.171942   0.090579  -1.898
## clean_sexNon-Binary                            0.099414   0.161590   0.615
##                                               Pr(>|t|)    
## (Intercept)                                   4.56e-10 ***
## PWS_cadencestepsminmean                        0.00048 ***
## demoEHR_Age                                    0.01239 *  
## demoEHR_DiseaseDuration                        0.16485    
## ms_dx_condensedProgressive MS                  0.03757 *  
## ms_dx_condensedMS, Subtype Not Specified       0.45757    
## race_ethnicity_cleanBlack Or African American  0.01008 *  
## race_ethnicity_cleanHispanic or Latino         0.77358    
## race_ethnicity_cleanWhite Not Hispanic         0.59845    
## race_ethnicity_cleanOther/Unknown/Declined     0.16233    
## clean_sexMale                                  0.06333 .  
## clean_sexNon-Binary                            0.54114    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2075 on 51 degrees of freedom
## Multiple R-squared:  0.776,  Adjusted R-squared:  0.7277 
## F-statistic: 16.06 on 11 and 51 DF,  p-value: 5.832e-13

# Left turns only 
metric_regression(home_l_df, t25fw_log, mean_cadence_step_per_min_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.51302 -0.25205 -0.01996  0.25132  0.71374 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.86342    0.36578   7.828 6.21e-08 ***
## mean_cadence_step_per_min_pose_hv -0.01178    0.00345  -3.415  0.00237 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3191 on 23 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.3365, Adjusted R-squared:  0.3076 
## F-statistic: 11.66 on 1 and 23 DF,  p-value: 0.00237

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47903 -0.14227 -0.00492  0.16519  0.38651 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.607878   0.478264   3.362
## mean_cadence_step_per_min_pose_hv          -0.004678   0.003513  -1.332
## demoEHR_Age                                 0.003291   0.005137   0.641
## demoEHR_DiseaseDuration                     0.005234   0.008678   0.603
## ms_dx_condensedProgressive MS               0.599228   0.211044   2.839
## ms_dx_condensedMS, Subtype Not Specified   -0.097642   0.215824  -0.452
## race_ethnicity_cleanHispanic or Latino      0.300032   0.396547   0.757
## race_ethnicity_cleanWhite Not Hispanic      0.309813   0.267730   1.157
## race_ethnicity_cleanOther/Unknown/Declined  0.046571   0.286849   0.162
## clean_sexMale                              -0.219844   0.156362  -1.406
##                                            Pr(>|t|)   
## (Intercept)                                 0.00428 **
## mean_cadence_step_per_min_pose_hv           0.20287   
## demoEHR_Age                                 0.53144   
## demoEHR_DiseaseDuration                     0.55545   
## ms_dx_condensedProgressive MS               0.01243 * 
## ms_dx_condensedMS, Subtype Not Specified    0.65744   
## race_ethnicity_cleanHispanic or Latino      0.46100   
## race_ethnicity_cleanWhite Not Hispanic      0.26529   
## race_ethnicity_cleanOther/Unknown/Declined  0.87319   
## clean_sexMale                               0.18010   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2403 on 15 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.7545, Adjusted R-squared:  0.6073 
## F-statistic: 5.123 on 9 and 15 DF,  p-value: 0.002781

# right turns only 
metric_regression(home_r_df, t25fw_log, mean_cadence_step_per_min_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.56097 -0.31590  0.00281  0.21244  0.79006 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.478456   0.393513   6.298 1.64e-06 ***
## mean_cadence_step_per_min_pose_hv -0.008487   0.003852  -2.203   0.0374 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3521 on 24 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.1682, Adjusted R-squared:  0.1336 
## F-statistic: 4.854 on 1 and 24 DF,  p-value: 0.03742

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.51783 -0.09212 -0.00925  0.12399  0.42613 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.308072   0.477983   2.737
## mean_cadence_step_per_min_pose_hv          -0.001921   0.003442  -0.558
## demoEHR_Age                                 0.002537   0.005282   0.480
## demoEHR_DiseaseDuration                     0.005978   0.008251   0.725
## ms_dx_condensedProgressive MS               0.721024   0.193542   3.725
## ms_dx_condensedMS, Subtype Not Specified   -0.039601   0.215730  -0.184
## race_ethnicity_cleanHispanic or Latino      0.404191   0.397255   1.017
## race_ethnicity_cleanWhite Not Hispanic      0.319485   0.273685   1.167
## race_ethnicity_cleanOther/Unknown/Declined  0.103026   0.277190   0.372
## clean_sexMale                              -0.228897   0.162461  -1.409
##                                            Pr(>|t|)   
## (Intercept)                                 0.01463 * 
## mean_cadence_step_per_min_pose_hv           0.58447   
## demoEHR_Age                                 0.63750   
## demoEHR_DiseaseDuration                     0.47917   
## ms_dx_condensedProgressive MS               0.00184 **
## ms_dx_condensedMS, Subtype Not Specified    0.85666   
## race_ethnicity_cleanHispanic or Latino      0.32407   
## race_ethnicity_cleanWhite Not Hispanic      0.26017   
## race_ethnicity_cleanOther/Unknown/Declined  0.71501   
## clean_sexMale                               0.17799   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2449 on 16 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.7318, Adjusted R-squared:  0.5809 
## F-statistic: 4.851 on 9 and 16 DF,  p-value: 0.003028

# unique IDs 
metric_regression(home_uniqueid_df, t25fw_log, mean_cadence_step_per_min_pose_hv)
## [1] "Data Frame:  home_uniqueid_df"
## Warning: Removed 8 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.55032 -0.26840 -0.00729  0.23992  0.66189 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        2.964594   0.378715   7.828 1.63e-07 ***
## mean_cadence_step_per_min_pose_hv -0.012415   0.003522  -3.525  0.00213 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3248 on 20 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.3832, Adjusted R-squared:  0.3524 
## F-statistic: 12.43 on 1 and 20 DF,  p-value: 0.002128

## [1] "t25fw_log ~ mean_cadence_step_per_min_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.46879 -0.13521  0.00492  0.13954  0.33860 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.730998   0.551000   3.142
## mean_cadence_step_per_min_pose_hv          -0.005597   0.004070  -1.375
## demoEHR_Age                                 0.002959   0.006091   0.486
## demoEHR_DiseaseDuration                     0.002639   0.009586   0.275
## ms_dx_condensedProgressive MS               0.529096   0.246963   2.142
## ms_dx_condensedMS, Subtype Not Specified   -0.092789   0.241584  -0.384
## race_ethnicity_cleanHispanic or Latino      0.353918   0.442291   0.800
## race_ethnicity_cleanWhite Not Hispanic      0.364105   0.303324   1.200
## race_ethnicity_cleanOther/Unknown/Declined  0.118661   0.310372   0.382
## clean_sexMale                              -0.260934   0.181813  -1.435
##                                            Pr(>|t|)   
## (Intercept)                                 0.00851 **
## mean_cadence_step_per_min_pose_hv           0.19422   
## demoEHR_Age                                 0.63579   
## demoEHR_DiseaseDuration                     0.78778   
## ms_dx_condensedProgressive MS               0.05336 . 
## ms_dx_condensedMS, Subtype Not Specified    0.70763   
## race_ethnicity_cleanHispanic or Latino      0.43915   
## race_ethnicity_cleanWhite Not Hispanic      0.25315   
## race_ethnicity_cleanOther/Unknown/Declined  0.70891   
## clean_sexMale                               0.17679   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2629 on 12 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.7575, Adjusted R-squared:  0.5756 
## F-statistic: 4.165 on 9 and 12 DF,  p-value: 0.01225

Univariate - home, stride width –> T25fw

# Home Videos 
sum(is.finite(home_df$stride_width_median_cm_pose_hv))
## [1] 51
## model  
metric_regression(home_df, t25fw_log, stride_width_median_cm_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 12 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.51421 -0.23980  0.02417  0.16497  0.83045 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     0.51023    0.22738   2.244   0.0294 *  
## stride_width_median_cm_pose_hv  0.08809    0.01757   5.013 7.41e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3097 on 49 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.339,  Adjusted R-squared:  0.3255 
## F-statistic: 25.13 on 1 and 49 DF,  p-value: 7.408e-06

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47343 -0.05906  0.00437  0.09373  0.32221 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.553533   0.206149   2.685
## stride_width_median_cm_pose_hv              0.050129   0.012259   4.089
## demoEHR_Age                                 0.001591   0.002778   0.573
## demoEHR_DiseaseDuration                     0.005727   0.004407   1.299
## ms_dx_condensedProgressive MS               0.639870   0.092362   6.928
## ms_dx_condensedMS, Subtype Not Specified   -0.160131   0.118131  -1.356
## race_ethnicity_cleanHispanic or Latino      0.287112   0.212499   1.351
## race_ethnicity_cleanWhite Not Hispanic      0.312424   0.144667   2.160
## race_ethnicity_cleanOther/Unknown/Declined  0.111080   0.150150   0.740
## clean_sexMale                              -0.217965   0.084440  -2.581
##                                            Pr(>|t|)    
## (Intercept)                                0.010417 *  
## stride_width_median_cm_pose_hv             0.000197 ***
## demoEHR_Age                                0.570079    
## demoEHR_DiseaseDuration                    0.201041    
## ms_dx_condensedProgressive MS              2.08e-08 ***
## ms_dx_condensedMS, Subtype Not Specified   0.182666    
## race_ethnicity_cleanHispanic or Latino     0.184065    
## race_ethnicity_cleanWhite Not Hispanic     0.036703 *  
## race_ethnicity_cleanOther/Unknown/Declined 0.463640    
## clean_sexMale                              0.013517 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1838 on 41 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.8052, Adjusted R-squared:  0.7625 
## F-statistic: 18.84 on 9 and 41 DF,  p-value: 6.384e-12

## pressure mat stride width model  
metric_regression(home_df, t25fw_log, PWS_stridewidthcmmean)
## [1] "Data Frame:  home_df"

## [1] "t25fw_log ~ PWS_stridewidthcmmean"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.59489 -0.21569 -0.05045  0.10379  1.04050 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            1.36895    0.15466   8.851 1.53e-12 ***
## PWS_stridewidthcmmean  0.03345    0.01708   1.958   0.0548 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3889 on 61 degrees of freedom
## Multiple R-squared:  0.05914,    Adjusted R-squared:  0.04372 
## F-statistic: 3.834 on 1 and 61 DF,  p-value: 0.05479

## [1] "t25fw_log ~ PWS_stridewidthcmmean + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57079 -0.09658  0.00000  0.11307  0.41540 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    1.188671   0.199078   5.971
## PWS_stridewidthcmmean                          0.016321   0.012149   1.343
## demoEHR_Age                                    0.003769   0.003033   1.242
## demoEHR_DiseaseDuration                        0.003020   0.005312   0.569
## ms_dx_condensedProgressive MS                  0.681621   0.099350   6.861
## ms_dx_condensedMS, Subtype Not Specified       0.056866   0.146133   0.389
## race_ethnicity_cleanBlack Or African American  1.086501   0.231640   4.690
## race_ethnicity_cleanHispanic or Latino         0.123461   0.235517   0.524
## race_ethnicity_cleanWhite Not Hispanic         0.061066   0.130208   0.469
## race_ethnicity_cleanOther/Unknown/Declined    -0.145615   0.153262  -0.950
## clean_sexMale                                 -0.278153   0.094439  -2.945
## clean_sexNon-Binary                            0.025798   0.178107   0.145
##                                               Pr(>|t|)    
## (Intercept)                                   2.28e-07 ***
## PWS_stridewidthcmmean                          0.18510    
## demoEHR_Age                                    0.21979    
## demoEHR_DiseaseDuration                        0.57217    
## ms_dx_condensedProgressive MS                 9.03e-09 ***
## ms_dx_condensedMS, Subtype Not Specified       0.69879    
## race_ethnicity_cleanBlack Or African American 2.08e-05 ***
## race_ethnicity_cleanHispanic or Latino         0.60240    
## race_ethnicity_cleanWhite Not Hispanic         0.64108    
## race_ethnicity_cleanOther/Unknown/Declined     0.34654    
## clean_sexMale                                  0.00485 ** 
## clean_sexNon-Binary                            0.88540    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2301 on 51 degrees of freedom
## Multiple R-squared:  0.7246, Adjusted R-squared:  0.6652 
## F-statistic:  12.2 on 11 and 51 DF,  p-value: 8.445e-11

# left only 
metric_regression(home_l_df, t25fw_log, stride_width_median_cm_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.43106 -0.27372  0.00517  0.17680  0.83812 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                     0.73046    0.39970   1.828   0.0806 .
## stride_width_median_cm_pose_hv  0.07175    0.03126   2.295   0.0312 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3534 on 23 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.1864, Adjusted R-squared:  0.151 
## F-statistic: 5.269 on 1 and 23 DF,  p-value: 0.03117

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47673 -0.04122  0.00401  0.07947  0.26128 
## 
## Coefficients:
##                                              Estimate Std. Error t value
## (Intercept)                                 0.4898646  0.3035972   1.614
## stride_width_median_cm_pose_hv              0.0633025  0.0197018   3.213
## demoEHR_Age                                -0.0002653  0.0042833  -0.062
## demoEHR_DiseaseDuration                     0.0099258  0.0071279   1.393
## ms_dx_condensedProgressive MS               0.6918538  0.1321152   5.237
## ms_dx_condensedMS, Subtype Not Specified   -0.1501074  0.1759680  -0.853
## race_ethnicity_cleanHispanic or Latino      0.2319664  0.3228908   0.718
## race_ethnicity_cleanWhite Not Hispanic      0.2880571  0.2178812   1.322
## race_ethnicity_cleanOther/Unknown/Declined -0.0093048  0.2343029  -0.040
## clean_sexMale                              -0.3245555  0.1320527  -2.458
##                                            Pr(>|t|)    
## (Intercept)                                 0.12746    
## stride_width_median_cm_pose_hv              0.00581 ** 
## demoEHR_Age                                 0.95143    
## demoEHR_DiseaseDuration                     0.18406    
## ms_dx_condensedProgressive MS               0.00010 ***
## ms_dx_condensedMS, Subtype Not Specified    0.40705    
## race_ethnicity_cleanHispanic or Latino      0.48355    
## race_ethnicity_cleanWhite Not Hispanic      0.20595    
## race_ethnicity_cleanOther/Unknown/Declined  0.96885    
## clean_sexMale                               0.02663 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1956 on 15 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.8374, Adjusted R-squared:  0.7399 
## F-statistic: 8.584 on 9 and 15 DF,  p-value: 0.0001725

# right only 
metric_regression(home_r_df, t25fw_log, stride_width_median_cm_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50540 -0.18496  0.03658  0.12051  0.81958 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     0.34341    0.26231   1.309    0.203    
## stride_width_median_cm_pose_hv  0.10001    0.02005   4.988 4.28e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2705 on 24 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.509,  Adjusted R-squared:  0.4886 
## F-statistic: 24.88 on 1 and 24 DF,  p-value: 4.28e-05

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39743 -0.03506  0.01639  0.04885  0.37607 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.425543   0.363698   1.170
## stride_width_median_cm_pose_hv              0.055640   0.021719   2.562
## demoEHR_Age                                 0.002550   0.004407   0.579
## demoEHR_DiseaseDuration                     0.003172   0.006795   0.467
## ms_dx_condensedProgressive MS               0.548278   0.164310   3.337
## ms_dx_condensedMS, Subtype Not Specified   -0.214161   0.195483  -1.096
## race_ethnicity_cleanHispanic or Latino      0.287874   0.339396   0.848
## race_ethnicity_cleanWhite Not Hispanic      0.334120   0.232009   1.440
## race_ethnicity_cleanOther/Unknown/Declined  0.198416   0.238176   0.833
## clean_sexMale                              -0.126195   0.139213  -0.906
##                                            Pr(>|t|)   
## (Intercept)                                 0.25912   
## stride_width_median_cm_pose_hv              0.02090 * 
## demoEHR_Age                                 0.57089   
## demoEHR_DiseaseDuration                     0.64686   
## ms_dx_condensedProgressive MS               0.00418 **
## ms_dx_condensedMS, Subtype Not Specified    0.28949   
## race_ethnicity_cleanHispanic or Latino      0.40884   
## race_ethnicity_cleanWhite Not Hispanic      0.16911   
## race_ethnicity_cleanOther/Unknown/Declined  0.41707   
## clean_sexMale                               0.37813   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2082 on 16 degrees of freedom
##   (6 observations deleted due to missingness)
## Multiple R-squared:  0.8061, Adjusted R-squared:  0.697 
## F-statistic: 7.391 on 9 and 16 DF,  p-value: 0.0003013

# unique IDs 
metric_regression(home_uniqueid_df, t25fw_log, stride_width_median_cm_pose_hv)
## [1] "Data Frame:  home_uniqueid_df"
## Warning: Removed 8 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.42575 -0.28031  0.01273  0.19963  0.81098 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                     0.60218    0.45328   1.328   0.1990  
## stride_width_median_cm_pose_hv  0.08196    0.03486   2.351   0.0291 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.366 on 20 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.2166, Adjusted R-squared:  0.1774 
## F-statistic: 5.529 on 1 and 20 DF,  p-value: 0.02906

## [1] "t25fw_log ~ stride_width_median_cm_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.41032 -0.08328 -0.00005  0.14000  0.25147 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.422694   0.359137   1.177
## stride_width_median_cm_pose_hv              0.067558   0.022977   2.940
## demoEHR_Age                                 0.001325   0.005003   0.265
## demoEHR_DiseaseDuration                     0.001380   0.007862   0.176
## ms_dx_condensedProgressive MS               0.675926   0.147378   4.586
## ms_dx_condensedMS, Subtype Not Specified   -0.102221   0.196263  -0.521
## race_ethnicity_cleanHispanic or Latino      0.355176   0.361294   0.983
## race_ethnicity_cleanWhite Not Hispanic      0.291171   0.248645   1.171
## race_ethnicity_cleanOther/Unknown/Declined  0.109104   0.254620   0.428
## clean_sexMale                              -0.324093   0.151407  -2.141
##                                            Pr(>|t|)    
## (Intercept)                                0.262025    
## stride_width_median_cm_pose_hv             0.012366 *  
## demoEHR_Age                                0.795602    
## demoEHR_DiseaseDuration                    0.863570    
## ms_dx_condensedProgressive MS              0.000626 ***
## ms_dx_condensedMS, Subtype Not Specified   0.611957    
## race_ethnicity_cleanHispanic or Latino     0.344981    
## race_ethnicity_cleanWhite Not Hispanic     0.264314    
## race_ethnicity_cleanOther/Unknown/Declined 0.675879    
## clean_sexMale                              0.053540 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2156 on 12 degrees of freedom
##   (8 observations deleted due to missingness)
## Multiple R-squared:  0.8368, Adjusted R-squared:  0.7145 
## F-statistic: 6.839 on 9 and 12 DF,  p-value: 0.00151

Interesting Stride width associated with T25fw in home videos, but not in person…?

Univariate - home, Stance Time –> T25fw

Stance/swing/double/single support measures not calculated for all participants

# Home Video  
sum(is.finite(home_df$foot1_stance_time_mean_pose_hv))
## [1] 31
#video model  
metric_regression(home_df, t25fw_log, foot1_stance_time_mean_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 32 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.41369 -0.21596 -0.02146  0.22394  0.50692 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.8684     0.1333   6.516 3.91e-07 ***
## foot1_stance_time_mean_pose_hv   0.9180     0.1425   6.441 4.79e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2601 on 29 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.5886, Adjusted R-squared:  0.5744 
## F-statistic: 41.48 on 1 and 29 DF,  p-value: 4.789e-07

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39587 -0.14503 -0.02896  0.13481  0.45123 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.916236   0.328072   2.793
## foot1_stance_time_mean_pose_hv              0.582100   0.245299   2.373
## demoEHR_Age                                 0.003896   0.004971   0.784
## demoEHR_DiseaseDuration                     0.006127   0.008551   0.716
## ms_dx_condensedProgressive MS               0.281338   0.233640   1.204
## ms_dx_condensedMS, Subtype Not Specified   -0.133046   0.165995  -0.802
## race_ethnicity_cleanOther/Unknown/Declined -0.204713   0.165585  -1.236
## clean_sexMale                              -0.195809   0.134007  -1.461
##                                            Pr(>|t|)  
## (Intercept)                                  0.0103 *
## foot1_stance_time_mean_pose_hv               0.0264 *
## demoEHR_Age                                  0.4412  
## demoEHR_DiseaseDuration                      0.4809  
## ms_dx_condensedProgressive MS                0.2408  
## ms_dx_condensedMS, Subtype Not Specified     0.4310  
## race_ethnicity_cleanOther/Unknown/Declined   0.2288  
## clean_sexMale                                0.1575  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2325 on 23 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.7393, Adjusted R-squared:   0.66 
## F-statistic: 9.318 on 7 and 23 DF,  p-value: 1.866e-05

# no pressure mat value 

# left only 
metric_regression(home_l_df, t25fw_log, foot1_stance_time_mean_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 18 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.43050 -0.25282  0.09124  0.15191  0.51482 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                      0.7179     0.2750   2.611  0.02423 * 
## foot1_stance_time_mean_pose_hv   1.1039     0.3145   3.510  0.00489 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2856 on 11 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.5282, Adjusted R-squared:  0.4854 
## F-statistic: 12.32 on 1 and 11 DF,  p-value: 0.004887

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##          1          9         13         15         17         22         28 
## -8.747e-02 -1.468e-01  1.164e-01  1.601e-01  8.747e-02  4.857e-17 -8.675e-02 
##         38         42         52         56         60         62 
##  1.468e-01 -1.316e-01 -9.460e-02  3.347e-01 -2.982e-01  6.939e-18 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.888313   0.493821   1.799
## foot1_stance_time_mean_pose_hv              1.186527   0.643712   1.843
## demoEHR_Age                                 0.001566   0.008696   0.180
## demoEHR_DiseaseDuration                    -0.015355   0.020965  -0.732
## ms_dx_condensedProgressive MS              -0.191498   0.460179  -0.416
## ms_dx_condensedMS, Subtype Not Specified   -0.395736   0.318957  -1.241
## race_ethnicity_cleanOther/Unknown/Declined -0.387180   0.301270  -1.285
## clean_sexMale                              -0.615623   0.260421  -2.364
##                                            Pr(>|t|)  
## (Intercept)                                  0.1320  
## foot1_stance_time_mean_pose_hv               0.1246  
## demoEHR_Age                                  0.8642  
## demoEHR_DiseaseDuration                      0.4968  
## ms_dx_condensedProgressive MS                0.6946  
## ms_dx_condensedMS, Subtype Not Specified     0.2697  
## race_ethnicity_cleanOther/Unknown/Declined   0.2550  
## clean_sexMale                                0.0644 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2578 on 5 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.8252, Adjusted R-squared:  0.5806 
## F-statistic: 3.373 on 7 and 5 DF,  p-value: 0.09973

# right only 
metric_regression(home_r_df, t25fw_log, foot1_stance_time_mean_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 14 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.36323 -0.20606 -0.01964  0.22125  0.38835 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      0.9190     0.1573   5.842 2.50e-05 ***
## foot1_stance_time_mean_pose_hv   0.8579     0.1611   5.325 6.84e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2534 on 16 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.6393, Adjusted R-squared:  0.6167 
## F-statistic: 28.36 on 1 and 16 DF,  p-value: 6.837e-05

## [1] "t25fw_log ~ foot1_stance_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.41999 -0.13309  0.01339  0.13324  0.33547 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.310984   0.630472   0.493
## foot1_stance_time_mean_pose_hv              0.804728   0.376455   2.138
## demoEHR_Age                                 0.013582   0.009516   1.427
## demoEHR_DiseaseDuration                    -0.002743   0.013076  -0.210
## ms_dx_condensedProgressive MS               0.053945   0.394634   0.137
## ms_dx_condensedMS, Subtype Not Specified   -0.240588   0.256620  -0.938
## race_ethnicity_cleanOther/Unknown/Declined -0.005601   0.238902  -0.023
## clean_sexMale                               0.079479   0.241806   0.329
##                                            Pr(>|t|)  
## (Intercept)                                  0.6325  
## foot1_stance_time_mean_pose_hv               0.0583 .
## demoEHR_Age                                  0.1840  
## demoEHR_DiseaseDuration                      0.8381  
## ms_dx_condensedProgressive MS                0.8940  
## ms_dx_condensedMS, Subtype Not Specified     0.3706  
## race_ethnicity_cleanOther/Unknown/Declined   0.9818  
## clean_sexMale                                0.7492  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2409 on 10 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7963, Adjusted R-squared:  0.6537 
## F-statistic: 5.584 on 7 and 10 DF,  p-value: 0.007773

# unique IDs - insufficent data? - less than one factor group
# metric_regression(home_uniqueid_df, t25fw_log, foot1_stance_time_mean_pose_hv)

Univariate - home, Swing Time –> T25fw

# Home  
sum(is.finite(home_df$foot1_swing_time_mean_pose_hv))
## [1] 31
ggplot(data = home_df, aes(x = foot1_swing_time_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = foot1_swing_per_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

# home all 
metric_regression(home_df, t25fw_log, foot1_swing_per_mean_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 32 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.76050 -0.21748 -0.07662  0.21468  0.59516 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   2.64720    0.26485   9.995 6.68e-11 ***
## foot1_swing_per_mean_pose_hv -0.03008    0.00796  -3.778 0.000728 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.332 on 29 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.3298, Adjusted R-squared:  0.3067 
## F-statistic: 14.27 on 1 and 29 DF,  p-value: 0.0007284

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.44780 -0.12159 -0.05335  0.11970  0.48762 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.668317   0.352202   4.737
## foot1_swing_per_mean_pose_hv               -0.006034   0.008650  -0.698
## demoEHR_Age                                 0.001255   0.005372   0.234
## demoEHR_DiseaseDuration                     0.009338   0.009352   0.999
## ms_dx_condensedProgressive MS               0.657984   0.189904   3.465
## ms_dx_condensedMS, Subtype Not Specified   -0.093124   0.182417  -0.511
## race_ethnicity_cleanOther/Unknown/Declined -0.197968   0.183884  -1.077
## clean_sexMale                              -0.239833   0.146364  -1.639
##                                            Pr(>|t|)    
## (Intercept)                                8.97e-05 ***
## foot1_swing_per_mean_pose_hv                 0.4924    
## demoEHR_Age                                  0.8173    
## demoEHR_DiseaseDuration                      0.3284    
## ms_dx_condensedProgressive MS                0.0021 ** 
## ms_dx_condensedMS, Subtype Not Specified     0.6146    
## race_ethnicity_cleanOther/Unknown/Declined   0.2928    
## clean_sexMale                                0.1149    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2567 on 23 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.6822, Adjusted R-squared:  0.5855 
## F-statistic: 7.053 on 7 and 23 DF,  p-value: 0.0001523

# left 
metric_regression(home_l_df, t25fw_log, foot1_swing_per_mean_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 18 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.43667 -0.14377 -0.04525  0.13613  0.63718 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   2.91606    0.39550   7.373 1.41e-05 ***
## foot1_swing_per_mean_pose_hv -0.03895    0.01183  -3.292  0.00718 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2951 on 11 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.4963, Adjusted R-squared:  0.4505 
## F-statistic: 10.84 on 1 and 11 DF,  p-value: 0.007178

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##          1          9         13         15         17         22         28 
## -6.902e-02 -3.696e-01 -9.420e-02  5.489e-02  6.902e-02  4.337e-17 -5.772e-02 
##         38         42         52         56         60         62 
##  3.696e-01 -2.034e-01 -1.271e-02  4.330e-01 -1.199e-01 -1.214e-17 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.938891   1.291443   1.501
## foot1_swing_per_mean_pose_hv               -0.011111   0.028263  -0.393
## demoEHR_Age                                 0.004564   0.011064   0.413
## demoEHR_DiseaseDuration                    -0.013171   0.027679  -0.476
## ms_dx_condensedProgressive MS               0.370438   0.516868   0.717
## ms_dx_condensedMS, Subtype Not Specified   -0.356351   0.412716  -0.863
## race_ethnicity_cleanOther/Unknown/Declined -0.244240   0.376367  -0.649
## clean_sexMale                              -0.454526   0.312527  -1.454
##                                            Pr(>|t|)
## (Intercept)                                   0.194
## foot1_swing_per_mean_pose_hv                  0.710
## demoEHR_Age                                   0.697
## demoEHR_DiseaseDuration                       0.654
## ms_dx_condensedProgressive MS                 0.506
## ms_dx_condensedMS, Subtype Not Specified      0.427
## race_ethnicity_cleanOther/Unknown/Declined    0.545
## clean_sexMale                                 0.206
## 
## Residual standard error: 0.3291 on 5 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.7153, Adjusted R-squared:  0.3167 
## F-statistic: 1.795 on 7 and 5 DF,  p-value: 0.2691

# right 
metric_regression(home_r_df, t25fw_log, foot1_swing_per_mean_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 14 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71011 -0.26002 -0.06287  0.24080  0.64492 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   2.49923    0.36398   6.866 3.79e-06 ***
## foot1_swing_per_mean_pose_hv -0.02500    0.01098  -2.278   0.0368 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3666 on 16 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.2448, Adjusted R-squared:  0.1976 
## F-statistic: 5.187 on 1 and 16 DF,  p-value: 0.03683

## [1] "t25fw_log ~ foot1_swing_per_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47783 -0.10059 -0.03943  0.12429  0.47731 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.612267   0.451118   3.574
## foot1_swing_per_mean_pose_hv               -0.007423   0.012151  -0.611
## demoEHR_Age                                 0.003041   0.009574   0.318
## demoEHR_DiseaseDuration                     0.009093   0.013840   0.657
## ms_dx_condensedProgressive MS               0.704167   0.271657   2.592
## ms_dx_condensedMS, Subtype Not Specified   -0.068797   0.286797  -0.240
## race_ethnicity_cleanOther/Unknown/Declined -0.123715   0.275217  -0.450
## clean_sexMale                              -0.176651   0.244744  -0.722
##                                            Pr(>|t|)   
## (Intercept)                                 0.00506 **
## foot1_swing_per_mean_pose_hv                0.55490   
## demoEHR_Age                                 0.75732   
## demoEHR_DiseaseDuration                     0.52602   
## ms_dx_condensedProgressive MS               0.02685 * 
## ms_dx_condensedMS, Subtype Not Specified    0.81527   
## race_ethnicity_cleanOther/Unknown/Declined  0.66264   
## clean_sexMale                               0.48697   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2854 on 10 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7139, Adjusted R-squared:  0.5136 
## F-statistic: 3.564 on 7 and 10 DF,  p-value: 0.03434

# unique IDs 
#metric_regression(home_uniqueid_df, t25fw_log, foot1_swing_per_mean_pose_hv)

Univariate - home, Single and Double Support –> T25fw

# home 
sum(is.finite(home_df$foot1_double_support_per_mean_pose_zv))
## [1] 0
ggplot(data = home_df, aes(x = foot1_double_support_per_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = foot1_ini_double_support_time_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = foot1_single_support_per_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = foot1_term_double_support_time_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = foot1_tot_double_support_time_mean_pose_hv, y = t25fw_log)) + 
  geom_point()
## Warning: Removed 32 rows containing missing values (`geom_point()`).

# home all 
metric_regression(home_df, t25fw_log, foot1_ini_double_support_time_mean_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 32 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_ini_double_support_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.55005 -0.20830  0.02674  0.17953  0.57793 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                 1.32828    0.08991  14.774 4.97e-15
## foot1_ini_double_support_time_mean_pose_hv  1.25675    0.26164   4.803 4.38e-05
##                                               
## (Intercept)                                ***
## foot1_ini_double_support_time_mean_pose_hv ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3026 on 29 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.4431, Adjusted R-squared:  0.4239 
## F-statistic: 23.07 on 1 and 29 DF,  p-value: 4.381e-05

## [1] "t25fw_log ~ foot1_ini_double_support_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.41357 -0.14148 -0.04077  0.13736  0.45177 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.335203   0.265041   5.038
## foot1_ini_double_support_time_mean_pose_hv  0.445953   0.334721   1.332
## demoEHR_Age                                 0.002312   0.005297   0.436
## demoEHR_DiseaseDuration                     0.007079   0.009324   0.759
## ms_dx_condensedProgressive MS               0.544934   0.204024   2.671
## ms_dx_condensedMS, Subtype Not Specified   -0.099146   0.177629  -0.558
## race_ethnicity_cleanOther/Unknown/Declined -0.201706   0.178141  -1.132
## clean_sexMale                              -0.224191   0.143177  -1.566
##                                            Pr(>|t|)    
## (Intercept)                                4.25e-05 ***
## foot1_ini_double_support_time_mean_pose_hv   0.1958    
## demoEHR_Age                                  0.6666    
## demoEHR_DiseaseDuration                      0.4554    
## ms_dx_condensedProgressive MS                0.0136 *  
## ms_dx_condensedMS, Subtype Not Specified     0.5821    
## race_ethnicity_cleanOther/Unknown/Declined   0.2692    
## clean_sexMale                                0.1310    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2499 on 23 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.6987, Adjusted R-squared:  0.607 
## F-statistic:  7.62 on 7 and 23 DF,  p-value: 8.689e-05

metric_regression(home_df, t25fw_log, foot1_term_double_support_time_mean_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 32 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71943 -0.22296 -0.00838  0.23779  0.61245 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                  1.37306    0.09222  14.889
## foot1_term_double_support_time_mean_pose_hv  1.40193    0.33723   4.157
##                                             Pr(>|t|)    
## (Intercept)                                 4.06e-15 ***
## foot1_term_double_support_time_mean_pose_hv 0.000261 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.321 on 29 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.3734, Adjusted R-squared:  0.3518 
## F-statistic: 17.28 on 1 and 29 DF,  p-value: 0.0002607

## [1] "t25fw_log ~ foot1_term_double_support_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.44340 -0.13760 -0.03355  0.11151  0.52202 
## 
## Coefficients:
##                                              Estimate Std. Error t value
## (Intercept)                                  1.325843   0.251176   5.279
## foot1_term_double_support_time_mean_pose_hv  0.596937   0.345816   1.726
## demoEHR_Age                                  0.002021   0.005073   0.398
## demoEHR_DiseaseDuration                      0.009160   0.008806   1.040
## ms_dx_condensedProgressive MS                0.552673   0.174183   3.173
## ms_dx_condensedMS, Subtype Not Specified    -0.107572   0.173592  -0.620
## race_ethnicity_cleanOther/Unknown/Declined  -0.180918   0.174726  -1.035
## clean_sexMale                               -0.251581   0.139054  -1.809
##                                             Pr(>|t|)    
## (Intercept)                                 2.34e-05 ***
## foot1_term_double_support_time_mean_pose_hv  0.09773 .  
## demoEHR_Age                                  0.69400    
## demoEHR_DiseaseDuration                      0.30907    
## ms_dx_condensedProgressive MS                0.00424 ** 
## ms_dx_condensedMS, Subtype Not Specified     0.54156    
## race_ethnicity_cleanOther/Unknown/Declined   0.31123    
## clean_sexMale                                0.08351 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2441 on 23 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.7127, Adjusted R-squared:  0.6253 
## F-statistic: 8.151 on 7 and 23 DF,  p-value: 5.259e-05

metric_regression(home_df, t25fw_log, foot1_tot_double_support_time_mean_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 32 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.48968 -0.23291 -0.01979  0.20780  0.57054 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                  1.2472     0.0880  14.173 1.44e-14
## foot1_tot_double_support_time_mean_pose_hv   0.8724     0.1495   5.837 2.50e-06
##                                               
## (Intercept)                                ***
## foot1_tot_double_support_time_mean_pose_hv ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.275 on 29 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.5402, Adjusted R-squared:  0.5243 
## F-statistic: 34.07 on 1 and 29 DF,  p-value: 2.496e-06

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.34331 -0.14480 -0.00802  0.12458  0.49292 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.182544   0.264666   4.468
## foot1_tot_double_support_time_mean_pose_hv  0.491971   0.223831   2.198
## demoEHR_Age                                 0.003794   0.005056   0.750
## demoEHR_DiseaseDuration                     0.005721   0.008742   0.654
## ms_dx_condensedProgressive MS               0.362727   0.217019   1.671
## ms_dx_condensedMS, Subtype Not Specified   -0.110090   0.167710  -0.656
## race_ethnicity_cleanOther/Unknown/Declined -0.175103   0.168754  -1.038
## clean_sexMale                              -0.227590   0.134525  -1.692
##                                            Pr(>|t|)    
## (Intercept)                                0.000175 ***
## foot1_tot_double_support_time_mean_pose_hv 0.038284 *  
## demoEHR_Age                                0.460577    
## demoEHR_DiseaseDuration                    0.519332    
## ms_dx_condensedProgressive MS              0.108194    
## ms_dx_condensedMS, Subtype Not Specified   0.518063    
## race_ethnicity_cleanOther/Unknown/Declined 0.310230    
## clean_sexMale                              0.104189    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2358 on 23 degrees of freedom
##   (32 observations deleted due to missingness)
## Multiple R-squared:  0.7318, Adjusted R-squared:  0.6502 
## F-statistic: 8.966 on 7 and 23 DF,  p-value: 2.527e-05

# home left 
metric_regression(home_l_df, t25fw_log, foot1_tot_double_support_time_mean_pose_hv)
## [1] "Data Frame:  home_l_df"
## Warning: Removed 18 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.51134 -0.24628  0.06383  0.15994  0.57887 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                  1.2089     0.1582   7.643 1.01e-05
## foot1_tot_double_support_time_mean_pose_hv   0.9723     0.3024   3.216  0.00822
##                                               
## (Intercept)                                ***
## foot1_tot_double_support_time_mean_pose_hv ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2985 on 11 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.4846, Adjusted R-squared:  0.4377 
## F-statistic: 10.34 on 1 and 11 DF,  p-value: 0.00822

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##          1          9         13         15         17         22         28 
## -1.271e-01 -1.132e-01  1.753e-03  1.310e-01  1.271e-01 -1.735e-17 -6.903e-02 
##         38         42         52         56         60         62 
##  1.132e-01 -1.671e-01 -1.102e-01  4.133e-01 -1.996e-01 -3.469e-18 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 1.398802   0.381377   3.668
## foot1_tot_double_support_time_mean_pose_hv  0.784056   0.422640   1.855
## demoEHR_Age                                 0.004114   0.008431   0.488
## demoEHR_DiseaseDuration                    -0.021115   0.021555  -0.980
## ms_dx_condensedProgressive MS               0.068055   0.345660   0.197
## ms_dx_condensedMS, Subtype Not Specified   -0.384447   0.318054  -1.209
## race_ethnicity_cleanOther/Unknown/Declined -0.291739   0.292978  -0.996
## clean_sexMale                              -0.611205   0.258827  -2.361
##                                            Pr(>|t|)  
## (Intercept)                                  0.0145 *
## foot1_tot_double_support_time_mean_pose_hv   0.1227  
## demoEHR_Age                                  0.6462  
## demoEHR_DiseaseDuration                      0.3723  
## ms_dx_condensedProgressive MS                0.8517  
## ms_dx_condensedMS, Subtype Not Specified     0.2808  
## race_ethnicity_cleanOther/Unknown/Declined   0.3651  
## clean_sexMale                                0.0646 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2571 on 5 degrees of freedom
##   (18 observations deleted due to missingness)
## Multiple R-squared:  0.8261, Adjusted R-squared:  0.5828 
## F-statistic: 3.394 on 7 and 5 DF,  p-value: 0.09862

# home right 
metric_regression(home_r_df, t25fw_log, foot1_tot_double_support_time_mean_pose_hv)
## [1] "Data Frame:  home_r_df"
## Warning: Removed 14 rows containing missing values (`geom_point()`).

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.45459 -0.20532 -0.01809  0.20460  0.46910 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                  1.2627     0.1123  11.242 5.26e-09
## foot1_tot_double_support_time_mean_pose_hv   0.8337     0.1777   4.691 0.000245
##                                               
## (Intercept)                                ***
## foot1_tot_double_support_time_mean_pose_hv ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2737 on 16 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.579,  Adjusted R-squared:  0.5527 
## F-statistic:    22 on 1 and 16 DF,  p-value: 0.0002454

## [1] "t25fw_log ~ foot1_tot_double_support_time_mean_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.37020 -0.14211  0.01509  0.13875  0.42195 
## 
## Coefficients:
##                                              Estimate Std. Error t value
## (Intercept)                                 0.7286486  0.5620906   1.296
## foot1_tot_double_support_time_mean_pose_hv  0.6897245  0.4137712   1.667
## demoEHR_Age                                 0.0119207  0.0103643   1.150
## demoEHR_DiseaseDuration                    -0.0002769  0.0139011  -0.020
## ms_dx_condensedProgressive MS               0.1703523  0.4274553   0.399
## ms_dx_condensedMS, Subtype Not Specified   -0.1901960  0.2704161  -0.703
## race_ethnicity_cleanOther/Unknown/Declined  0.0022200  0.2613434   0.008
## clean_sexMale                              -0.0154889  0.2438597  -0.064
##                                            Pr(>|t|)
## (Intercept)                                   0.224
## foot1_tot_double_support_time_mean_pose_hv    0.126
## demoEHR_Age                                   0.277
## demoEHR_DiseaseDuration                       0.984
## ms_dx_condensedProgressive MS                 0.699
## ms_dx_condensedMS, Subtype Not Specified      0.498
## race_ethnicity_cleanOther/Unknown/Declined    0.993
## clean_sexMale                                 0.951
## 
## Residual standard error: 0.2572 on 10 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7677, Adjusted R-squared:  0.6051 
## F-statistic: 4.722 on 7 and 10 DF,  p-value: 0.01394

Multivariate - home, Gait metrics only –> T25fw

Metrics only - not including double support/stance measures, too many missing. May include after improving code

# Home 
# confounding +
home_t25fw_multivar_model <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv,  
                               data = home_df)

summary(home_t25fw_multivar_model)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.38964 -0.17589  0.06283  0.18239  0.46609 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                         0.473285   0.461582   1.025   0.3108   
## log_delta_pix_h_rel_median_pose_hv -0.290997   0.118489  -2.456   0.0181 * 
## stride_time_median_sec_pose_hv      0.467391   0.224108   2.086   0.0429 * 
## mean_cadence_step_per_min_pose_hv  -0.003097   0.002533  -1.223   0.2280   
## stride_width_median_cm_pose_hv      0.045898   0.015859   2.894   0.0059 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2345 on 44 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.6534, Adjusted R-squared:  0.6219 
## F-statistic: 20.74 on 4 and 44 DF,  p-value: 1.154e-09
hist(resid(home_t25fw_multivar_model))

# interaction * 
home_t25fw_multivar_model_2 <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv * 
                                 stride_time_median_sec_pose_hv * 
                                 mean_cadence_step_per_min_pose_hv * 
                                 stride_width_median_cm_pose_hv,  
                               data = home_df)

summary(home_t25fw_multivar_model_2)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv * 
##     stride_time_median_sec_pose_hv * mean_cadence_step_per_min_pose_hv * 
##     stride_width_median_cm_pose_hv, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.34514 -0.14413 -0.00139  0.15571  0.31573 
## 
## Coefficients:
##                                                                                                                                     Estimate
## (Intercept)                                                                                                                         27.22718
## log_delta_pix_h_rel_median_pose_hv                                                                                                  29.31956
## stride_time_median_sec_pose_hv                                                                                                     -20.32178
## mean_cadence_step_per_min_pose_hv                                                                                                   -0.32198
## stride_width_median_cm_pose_hv                                                                                                      -2.33774
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                  -22.57757
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                -0.33906
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                     0.25505
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                   -2.32492
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                        1.94475
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                     0.03053
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                  0.26528
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                     1.81019
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                  0.02815
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                     -0.02552
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv  -0.02253
##                                                                                                                                    Std. Error
## (Intercept)                                                                                                                          33.35425
## log_delta_pix_h_rel_median_pose_hv                                                                                                   28.84964
## stride_time_median_sec_pose_hv                                                                                                       29.78914
## mean_cadence_step_per_min_pose_hv                                                                                                     0.39228
## stride_width_median_cm_pose_hv                                                                                                        2.16025
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                    23.85350
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                  0.34139
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                      0.36598
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                     1.85602
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                         1.92554
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                      0.02593
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                   0.29876
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                      1.49564
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                   0.02261
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                       0.02437
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv    0.01963
##                                                                                                                                    t value
## (Intercept)                                                                                                                          0.816
## log_delta_pix_h_rel_median_pose_hv                                                                                                   1.016
## stride_time_median_sec_pose_hv                                                                                                      -0.682
## mean_cadence_step_per_min_pose_hv                                                                                                   -0.821
## stride_width_median_cm_pose_hv                                                                                                      -1.082
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                   -0.947
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                -0.993
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                     0.697
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                   -1.253
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                        1.010
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                     1.178
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                  0.888
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                     1.210
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                  1.245
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                     -1.047
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv  -1.148
##                                                                                                                                    Pr(>|t|)
## (Intercept)                                                                                                                           0.420
## log_delta_pix_h_rel_median_pose_hv                                                                                                    0.317
## stride_time_median_sec_pose_hv                                                                                                        0.500
## mean_cadence_step_per_min_pose_hv                                                                                                     0.418
## stride_width_median_cm_pose_hv                                                                                                        0.287
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                     0.351
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                  0.328
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                      0.491
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                     0.219
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                         0.320
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                      0.247
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                   0.381
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                      0.235
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                   0.222
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                       0.303
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv    0.259
## 
## Residual standard error: 0.2068 on 33 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7979, Adjusted R-squared:  0.706 
## F-statistic: 8.685 on 15 and 33 DF,  p-value: 1.427e-07
hist(resid(home_t25fw_multivar_model_2))

Multivariate - home, Gait metrics + disease + demographics –> T25fw

# Home  
# Metrics + disease and demographic info  
# add MS subtype 
home_t25fw_multivar_model_3 <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv +
                                  ms_dx_condensed, 
                               data = home_df)

summary(home_t25fw_multivar_model_3)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39678 -0.20485  0.02895  0.16556  0.33456 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.949884   0.478360   1.986  0.05362
## log_delta_pix_h_rel_median_pose_hv       -0.173257   0.120180  -1.442  0.15682
## stride_time_median_sec_pose_hv           -0.019184   0.284086  -0.068  0.94648
## mean_cadence_step_per_min_pose_hv        -0.002312   0.002393  -0.966  0.33947
## stride_width_median_cm_pose_hv            0.053633   0.015880   3.377  0.00159
## ms_dx_condensedProgressive MS             0.529568   0.203319   2.605  0.01266
## ms_dx_condensedMS, Subtype Not Specified -0.098729   0.126304  -0.782  0.43879
##                                            
## (Intercept)                              . 
## log_delta_pix_h_rel_median_pose_hv         
## stride_time_median_sec_pose_hv             
## mean_cadence_step_per_min_pose_hv          
## stride_width_median_cm_pose_hv           **
## ms_dx_condensedProgressive MS            * 
## ms_dx_condensedMS, Subtype Not Specified   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2199 on 42 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7089, Adjusted R-squared:  0.6673 
## F-statistic: 17.05 on 6 and 42 DF,  p-value: 7.328e-10
hist(resid(home_t25fw_multivar_model_3))

# add age 
home_t25fw_multivar_model_4 <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv +
                                 ms_dx_condensed + 
                                 demoEHR_Age, 
                               data = home_df)

summary(home_t25fw_multivar_model_4)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed + demoEHR_Age, 
##     data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.40818 -0.14961  0.04824  0.12476  0.39527 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.484495   0.453209   1.069  0.29131
## log_delta_pix_h_rel_median_pose_hv       -0.107680   0.109998  -0.979  0.33336
## stride_time_median_sec_pose_hv            0.234346   0.267065   0.877  0.38533
## mean_cadence_step_per_min_pose_hv        -0.002027   0.002155  -0.940  0.35260
## stride_width_median_cm_pose_hv            0.040708   0.014824   2.746  0.00892
## ms_dx_condensedProgressive MS             0.388637   0.187957   2.068  0.04502
## ms_dx_condensedMS, Subtype Not Specified -0.242951   0.121841  -1.994  0.05283
## demoEHR_Age                               0.007966   0.002420   3.292  0.00205
##                                            
## (Intercept)                                
## log_delta_pix_h_rel_median_pose_hv         
## stride_time_median_sec_pose_hv             
## mean_cadence_step_per_min_pose_hv          
## stride_width_median_cm_pose_hv           **
## ms_dx_condensedProgressive MS            * 
## ms_dx_condensedMS, Subtype Not Specified . 
## demoEHR_Age                              **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.198 on 41 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7698, Adjusted R-squared:  0.7305 
## F-statistic: 19.58 on 7 and 41 DF,  p-value: 3.176e-11
hist(resid(home_t25fw_multivar_model_4))

# add disease duration 
home_t25fw_multivar_model_5 <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv +
                                 ms_dx_condensed + 
                                  demoEHR_Age +  
                                 demoEHR_DiseaseDuration, 
                               data = home_df)

summary(home_t25fw_multivar_model_5)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39030 -0.15718  0.02653  0.12222  0.38935 
## 
## Coefficients:
##                                           Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               0.445364   0.457749   0.973  0.33643
## log_delta_pix_h_rel_median_pose_hv       -0.112329   0.110623  -1.015  0.31601
## stride_time_median_sec_pose_hv            0.255871   0.269545   0.949  0.34818
## mean_cadence_step_per_min_pose_hv        -0.001880   0.002172  -0.865  0.39203
## stride_width_median_cm_pose_hv            0.040532   0.014890   2.722  0.00956
## ms_dx_condensedProgressive MS             0.394215   0.188894   2.087  0.04331
## ms_dx_condensedMS, Subtype Not Specified -0.249582   0.122643  -2.035  0.04851
## demoEHR_Age                               0.007115   0.002650   2.685  0.01051
## demoEHR_DiseaseDuration                   0.003405   0.004228   0.805  0.42538
##                                            
## (Intercept)                                
## log_delta_pix_h_rel_median_pose_hv         
## stride_time_median_sec_pose_hv             
## mean_cadence_step_per_min_pose_hv          
## stride_width_median_cm_pose_hv           **
## ms_dx_condensedProgressive MS            * 
## ms_dx_condensedMS, Subtype Not Specified * 
## demoEHR_Age                              * 
## demoEHR_DiseaseDuration                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1988 on 40 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7734, Adjusted R-squared:  0.7281 
## F-statistic: 17.07 on 8 and 40 DF,  p-value: 1.085e-10
hist(resid(home_t25fw_multivar_model_5))

# add race and ethnicity 
home_t25fw_multivar_model_6 <- lm(t25fw_log ~  log_delta_pix_h_rel_median_pose_hv + 
                                  stride_time_median_sec_pose_hv + 
                                  stride_width_median_cm_pose_hv + 
                                  ms_dx_condensed + 
                                  demoEHR_Age + 
                                  demoEHR_DiseaseDuration + 
                                  race_ethnicity_clean, 
                               data = home_df)

summary(home_t25fw_multivar_model_6)
## 
## Call:
## lm(formula = t25fw_log ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + stride_width_median_cm_pose_hv + 
##     ms_dx_condensed + demoEHR_Age + demoEHR_DiseaseDuration + 
##     race_ethnicity_clean, data = home_df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.36318 -0.11606  0.01794  0.10324  0.37890 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                 0.065546   0.326814   0.201
## log_delta_pix_h_rel_median_pose_hv         -0.122401   0.108846  -1.125
## stride_time_median_sec_pose_hv              0.342211   0.246698   1.387
## stride_width_median_cm_pose_hv              0.038408   0.014878   2.582
## ms_dx_condensedProgressive MS               0.383923   0.185693   2.068
## ms_dx_condensedMS, Subtype Not Specified   -0.252643   0.126893  -1.991
## demoEHR_Age                                 0.004604   0.002898   1.589
## demoEHR_DiseaseDuration                     0.005998   0.004857   1.235
## race_ethnicity_cleanHispanic or Latino      0.236485   0.228765   1.034
## race_ethnicity_cleanWhite Not Hispanic      0.235283   0.150759   1.561
## race_ethnicity_cleanOther/Unknown/Declined  0.096786   0.161344   0.600
##                                            Pr(>|t|)  
## (Intercept)                                  0.8421  
## log_delta_pix_h_rel_median_pose_hv           0.2678  
## stride_time_median_sec_pose_hv               0.1735  
## stride_width_median_cm_pose_hv               0.0138 *
## ms_dx_condensedProgressive MS                0.0455 *
## ms_dx_condensedMS, Subtype Not Specified     0.0537 .
## demoEHR_Age                                  0.1204  
## demoEHR_DiseaseDuration                      0.2245  
## race_ethnicity_cleanHispanic or Latino       0.3078  
## race_ethnicity_cleanWhite Not Hispanic       0.1269  
## race_ethnicity_cleanOther/Unknown/Declined   0.5522  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1952 on 38 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7926, Adjusted R-squared:  0.7381 
## F-statistic: 14.53 on 10 and 38 DF,  p-value: 3.836e-10
hist(resid(home_t25fw_multivar_model_6))

Linear Regression –> PWS Velocity Zeno Velocity

Preferred walking speed

Demographics Only

pws_matvel_dem_model <- lm(PWS_velocitycmsecmean ~ 
                      ms_dx_condensed + 
                      demoEHR_Age + 
                      demoEHR_DiseaseDuration + 
                      race_ethnicity_clean, 
                    data = zeno_pws_df)

summary(pws_matvel_dem_model)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -64.277 -16.815   2.337  18.755  69.779 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                   120.29915    9.50111  12.662
## ms_dx_condensedProgressive MS                 -33.69399    5.36047  -6.286
## ms_dx_condensedMS, Subtype Not Specified       13.96842   19.26563   0.725
## demoEHR_Age                                    -0.10435    0.19632  -0.532
## demoEHR_DiseaseDuration                         0.01945    0.25790   0.075
## race_ethnicity_cleanBlack Or African American -26.52248    9.83961  -2.695
## race_ethnicity_cleanHispanic or Latino         -6.14212    8.82214  -0.696
## race_ethnicity_cleanWhite Not Hispanic         -5.00506    7.21961  -0.693
## race_ethnicity_cleanOther/Unknown/Declined     -6.10194    9.05229  -0.674
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## ms_dx_condensedProgressive MS                 1.89e-09 ***
## ms_dx_condensedMS, Subtype Not Specified        0.4692    
## demoEHR_Age                                     0.5956    
## demoEHR_DiseaseDuration                         0.9400    
## race_ethnicity_cleanBlack Or African American   0.0076 ** 
## race_ethnicity_cleanHispanic or Latino          0.4871    
## race_ethnicity_cleanWhite Not Hispanic          0.4889    
## race_ethnicity_cleanOther/Unknown/Declined      0.5010    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.65 on 208 degrees of freedom
## Multiple R-squared:  0.239,  Adjusted R-squared:  0.2097 
## F-statistic: 8.166 on 8 and 208 DF,  p-value: 1.369e-09
hist(resid(pws_matvel_dem_model))

pws_matvel_dem_model_2 <- lm(PWS_velocitycmsecmean ~ 
                      ms_dx_condensed + 
                      demoEHR_Age + 
                      demoEHR_DiseaseDuration + 
                      race_ethnicity_clean, 
                    data = zeno_pws_uniqueid_df)

summary(pws_matvel_dem_model_2)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = zeno_pws_uniqueid_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -62.104 -17.662  -0.462  18.947  62.095 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                   118.66079   11.33605  10.468
## ms_dx_condensedProgressive MS                 -35.37281    6.14574  -5.756
## ms_dx_condensedMS, Subtype Not Specified       18.00988   19.36443   0.930
## demoEHR_Age                                    -0.03415    0.21723  -0.157
## demoEHR_DiseaseDuration                        -0.23638    0.32038  -0.738
## race_ethnicity_cleanBlack Or African American -20.94183   11.49151  -1.822
## race_ethnicity_cleanHispanic or Latino         -7.56336   10.58983  -0.714
## race_ethnicity_cleanWhite Not Hispanic         -7.54175    8.75675  -0.861
## race_ethnicity_cleanOther/Unknown/Declined     -7.56229   11.16546  -0.677
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## ms_dx_condensedProgressive MS                 5.06e-08 ***
## ms_dx_condensedMS, Subtype Not Specified        0.3539    
## demoEHR_Age                                     0.8753    
## demoEHR_DiseaseDuration                         0.4618    
## race_ethnicity_cleanBlack Or African American   0.0705 .  
## race_ethnicity_cleanHispanic or Latino          0.4763    
## race_ethnicity_cleanWhite Not Hispanic          0.3905    
## race_ethnicity_cleanOther/Unknown/Declined      0.4993    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.61 on 143 degrees of freedom
## Multiple R-squared:  0.2573, Adjusted R-squared:  0.2158 
## F-statistic: 6.194 on 8 and 143 DF,  p-value: 7.358e-07
hist(resid(pws_matvel_dem_model_2))

# Preferred walking speed Zeno 

hist(zeno_pws_df$PWS_velocitycmsecmean)

ggplot(data = zeno_pws_df, aes(x = log_delta_pix_h_rel_median_pose_zv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 14 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_time_median_sec_pose_zv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 48 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = mean_cadence_step_per_min_pose_zv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

ggplot(data = zeno_pws_df, aes(x = stride_width_median_cm_pose_zv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 40 rows containing missing values (`geom_point()`).

Univariate regressions - each video metric

metric_regression(zeno_pws_df, PWS_velocitycmsecmean, log_delta_pix_h_rel_median_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 14 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -60.968 -20.258   1.462  14.689  85.410 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         146.342      5.449  26.856  < 2e-16 ***
## log_delta_pix_h_rel_median_pose_zv   30.650      3.631   8.441 6.21e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.44 on 201 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.2617, Adjusted R-squared:  0.258 
## F-statistic: 71.24 on 1 and 201 DF,  p-value: 6.212e-15

## [1] "PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -57.20 -15.56   0.47  17.50  68.71 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## (Intercept)                                   160.966620  11.023121  14.603
## log_delta_pix_h_rel_median_pose_zv             23.490487   3.785996   6.205
## demoEHR_Age                                    -0.200511   0.184141  -1.089
## demoEHR_DiseaseDuration                         0.002313   0.243415   0.010
## ms_dx_condensedProgressive MS                 -22.137904   5.651293  -3.917
## ms_dx_condensedMS, Subtype Not Specified       11.658966  17.855576   0.653
## race_ethnicity_cleanBlack Or African American -31.210375   9.360920  -3.334
## race_ethnicity_cleanHispanic or Latino        -12.462700   8.691511  -1.434
## race_ethnicity_cleanWhite Not Hispanic         -9.399209   7.050092  -1.333
## race_ethnicity_cleanOther/Unknown/Declined    -11.009483   8.830550  -1.247
## clean_sexMale                                  -2.243003   4.236191  -0.529
## clean_sexNon-Binary                            -2.580832  24.874815  -0.104
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## log_delta_pix_h_rel_median_pose_zv            3.33e-09 ***
## demoEHR_Age                                   0.277571    
## demoEHR_DiseaseDuration                       0.992430    
## ms_dx_condensedProgressive MS                 0.000125 ***
## ms_dx_condensedMS, Subtype Not Specified      0.514568    
## race_ethnicity_cleanBlack Or African American 0.001028 ** 
## race_ethnicity_cleanHispanic or Latino        0.153238    
## race_ethnicity_cleanWhite Not Hispanic        0.184053    
## race_ethnicity_cleanOther/Unknown/Declined    0.214016    
## clean_sexMale                                 0.597083    
## clean_sexNon-Binary                           0.917474    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 24.61 on 191 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.3921, Adjusted R-squared:  0.3571 
## F-statistic:  11.2 on 11 and 191 DF,  p-value: 6.393e-16

metric_regression(zeno_pws_df, PWS_velocitycmsecmean, stride_time_median_sec_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 48 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ stride_time_median_sec_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -96.262 -14.416   1.544  16.620  49.338 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      210.13      13.45  15.620  < 2e-16 ***
## stride_time_median_sec_pose_zv   -94.27      11.87  -7.939 2.84e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 22.78 on 167 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.274,  Adjusted R-squared:  0.2696 
## F-statistic: 63.02 on 1 and 167 DF,  p-value: 2.84e-13

## [1] "PWS_velocitycmsecmean ~ stride_time_median_sec_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -94.695 -13.909   2.375  14.538  44.584 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                   213.5351    16.6498  12.825
## stride_time_median_sec_pose_zv                -85.9863    11.9821  -7.176
## demoEHR_Age                                    -0.1684     0.1851  -0.910
## demoEHR_DiseaseDuration                        -0.3027     0.2486  -1.218
## ms_dx_condensedProgressive MS                 -12.1565     5.4398  -2.235
## ms_dx_condensedMS, Subtype Not Specified       15.8514    15.7677   1.005
## race_ethnicity_cleanBlack Or African American -20.1646     9.0572  -2.226
## race_ethnicity_cleanHispanic or Latino          6.4141     8.2043   0.782
## race_ethnicity_cleanWhite Not Hispanic          1.1599     6.8861   0.168
## race_ethnicity_cleanOther/Unknown/Declined     -3.6449     9.6685  -0.377
## clean_sexMale                                   1.1758     3.9167   0.300
## clean_sexNon-Binary                             1.9397    21.9132   0.089
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## stride_time_median_sec_pose_zv                2.68e-11 ***
## demoEHR_Age                                     0.3644    
## demoEHR_DiseaseDuration                         0.2251    
## ms_dx_condensedProgressive MS                   0.0268 *  
## ms_dx_condensedMS, Subtype Not Specified        0.3163    
## race_ethnicity_cleanBlack Or African American   0.0274 *  
## race_ethnicity_cleanHispanic or Latino          0.4355    
## race_ethnicity_cleanWhite Not Hispanic          0.8665    
## race_ethnicity_cleanOther/Unknown/Declined      0.7067    
## clean_sexMale                                   0.7644    
## clean_sexNon-Binary                             0.9296    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.67 on 157 degrees of freedom
##   (48 observations deleted due to missingness)
## Multiple R-squared:  0.3825, Adjusted R-squared:  0.3392 
## F-statistic:  8.84 on 11 and 157 DF,  p-value: 4.017e-12

metric_regression(zeno_pws_df, PWS_velocitycmsecmean, mean_cadence_step_per_min_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 40 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ mean_cadence_step_per_min_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -72.074 -14.455   2.047  15.820  49.555 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        -3.9456    12.2997  -0.321    0.749    
## mean_cadence_step_per_min_pose_zv   1.0332     0.1176   8.785 1.41e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 23.27 on 175 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.306,  Adjusted R-squared:  0.3021 
## F-statistic: 77.17 on 1 and 175 DF,  p-value: 1.411e-15

## [1] "PWS_velocitycmsecmean ~ mean_cadence_step_per_min_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -73.636 -15.400   2.225  13.757  45.370 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                    13.6417    15.3470   0.889
## mean_cadence_step_per_min_pose_zv               0.9643     0.1168   8.257
## demoEHR_Age                                    -0.1830     0.1784  -1.026
## demoEHR_DiseaseDuration                        -0.2379     0.2376  -1.001
## ms_dx_condensedProgressive MS                 -16.9654     5.0872  -3.335
## ms_dx_condensedMS, Subtype Not Specified       10.6654    15.6198   0.683
## race_ethnicity_cleanBlack Or African American -20.8631     8.9404  -2.334
## race_ethnicity_cleanHispanic or Latino          3.5656     8.0369   0.444
## race_ethnicity_cleanWhite Not Hispanic          4.2542     6.7972   0.626
## race_ethnicity_cleanOther/Unknown/Declined      6.5356     9.4753   0.690
## clean_sexMale                                   4.8437     3.8322   1.264
## clean_sexNon-Binary                            -2.0406    21.7045  -0.094
##                                               Pr(>|t|)    
## (Intercept)                                    0.37536    
## mean_cadence_step_per_min_pose_zv              4.6e-14 ***
## demoEHR_Age                                    0.30645    
## demoEHR_DiseaseDuration                        0.31820    
## ms_dx_condensedProgressive MS                  0.00105 ** 
## ms_dx_condensedMS, Subtype Not Specified       0.49568    
## race_ethnicity_cleanBlack Or African American  0.02082 *  
## race_ethnicity_cleanHispanic or Latino         0.65788    
## race_ethnicity_cleanWhite Not Hispanic         0.53226    
## race_ethnicity_cleanOther/Unknown/Declined     0.49132    
## clean_sexMale                                  0.20803    
## clean_sexNon-Binary                            0.92521    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.45 on 165 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.4437, Adjusted R-squared:  0.4066 
## F-statistic: 11.96 on 11 and 165 DF,  p-value: 2.508e-16

metric_regression(zeno_pws_df, PWS_velocitycmsecmean, stride_width_median_cm_pose_zv)
## [1] "Data Frame:  zeno_pws_df"
## Warning: Removed 40 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ stride_width_median_cm_pose_zv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -101.589  -15.870    5.143   19.832   71.560 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                    129.1508     7.7260  16.716  < 2e-16 ***
## stride_width_median_cm_pose_zv  -2.0966     0.5978  -3.507 0.000575 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27 on 175 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.06568,    Adjusted R-squared:  0.06034 
## F-statistic:  12.3 on 1 and 175 DF,  p-value: 0.0005749

## [1] "PWS_velocitycmsecmean ~ stride_width_median_cm_pose_zv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -73.605 -17.520   4.266  19.684  63.927 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                   131.13849   13.18956   9.943
## stride_width_median_cm_pose_zv                 -1.10097    0.60153  -1.830
## demoEHR_Age                                    -0.18336    0.20999  -0.873
## demoEHR_DiseaseDuration                         0.03058    0.27700   0.110
## ms_dx_condensedProgressive MS                 -25.33483    6.00672  -4.218
## ms_dx_condensedMS, Subtype Not Specified       17.85317   18.40265   0.970
## race_ethnicity_cleanBlack Or African American -24.71917   10.51202  -2.352
## race_ethnicity_cleanHispanic or Latino          0.40312    9.54618   0.042
## race_ethnicity_cleanWhite Not Hispanic         -0.36837    8.03850  -0.046
## race_ethnicity_cleanOther/Unknown/Declined    -10.93036   10.96116  -0.997
## clean_sexMale                                   2.03036    4.50022   0.451
## clean_sexNon-Binary                             7.69159   25.52853   0.301
##                                               Pr(>|t|)    
## (Intercept)                                    < 2e-16 ***
## stride_width_median_cm_pose_zv                  0.0690 .  
## demoEHR_Age                                     0.3838    
## demoEHR_DiseaseDuration                         0.9122    
## ms_dx_condensedProgressive MS                 4.06e-05 ***
## ms_dx_condensedMS, Subtype Not Specified        0.3334    
## race_ethnicity_cleanBlack Or African American   0.0199 *  
## race_ethnicity_cleanHispanic or Latino          0.9664    
## race_ethnicity_cleanWhite Not Hispanic          0.9635    
## race_ethnicity_cleanOther/Unknown/Declined      0.3201    
## clean_sexMale                                   0.6525    
## clean_sexNon-Binary                             0.7636    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25.25 on 165 degrees of freedom
##   (40 observations deleted due to missingness)
## Multiple R-squared:  0.2295, Adjusted R-squared:  0.1781 
## F-statistic: 4.468 on 11 and 165 DF,  p-value: 6.822e-06

Multivariate regression

# Metrics only - not including double support/stance measures, too many missing 
# confounding + 
pws_matvel_multivar_model <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv, data = zeno_pws_df)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -96.54 -13.18   0.82  16.24  40.18 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        101.9025    36.6945   2.777 0.006176 ** 
## log_delta_pix_h_rel_median_pose_zv   4.0642     4.1088   0.989 0.324163    
## stride_time_median_sec_pose_zv     -42.1065    16.4597  -2.558 0.011501 *  
## mean_cadence_step_per_min_pose_zv    0.6940     0.1945   3.568 0.000481 ***
## stride_width_median_cm_pose_zv      -1.4094     0.5540  -2.544 0.011948 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.81 on 152 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.3782, Adjusted R-squared:  0.3619 
## F-statistic: 23.11 on 4 and 152 DF,  p-value: 6.166e-15
hist(resid(pws_matvel_multivar_model))

# PWS interaction * 
pws_matvel_multivar_model_2 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv * 
                                 stride_time_median_sec_pose_zv * 
                                 mean_cadence_step_per_min_pose_zv * 
                                 stride_width_median_cm_pose_zv, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model_2)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv * 
##     stride_time_median_sec_pose_zv * mean_cadence_step_per_min_pose_zv * 
##     stride_width_median_cm_pose_zv, data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -73.827 -11.254   0.822  14.280  36.320 
## 
## Coefficients:
##                                                                                                                                      Estimate
## (Intercept)                                                                                                                         2318.8462
## log_delta_pix_h_rel_median_pose_zv                                                                                                   883.5118
## stride_time_median_sec_pose_zv                                                                                                     -1747.2510
## mean_cadence_step_per_min_pose_zv                                                                                                    -18.9828
## stride_width_median_cm_pose_zv                                                                                                      -177.1575
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                   -570.6399
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                  -7.2171
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                      14.8183
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    -72.9952
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        141.7145
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                       1.6658
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                    4.2169
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                      52.6956
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                    0.6679
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                       -1.3345
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv    -0.4658
##                                                                                                                                    Std. Error
## (Intercept)                                                                                                                         1115.9297
## log_delta_pix_h_rel_median_pose_zv                                                                                                   784.9593
## stride_time_median_sec_pose_zv                                                                                                       858.4759
## mean_cadence_step_per_min_pose_zv                                                                                                      9.4037
## stride_width_median_cm_pose_zv                                                                                                        89.1389
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    529.7408
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                   7.2291
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                       7.3381
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                     58.4011
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                         72.6931
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                       0.7697
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                    5.1632
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                      39.8877
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                    0.5388
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                        0.6395
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv     0.3814
##                                                                                                                                    t value
## (Intercept)                                                                                                                          2.078
## log_delta_pix_h_rel_median_pose_zv                                                                                                   1.126
## stride_time_median_sec_pose_zv                                                                                                      -2.035
## mean_cadence_step_per_min_pose_zv                                                                                                   -2.019
## stride_width_median_cm_pose_zv                                                                                                      -1.987
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                   -1.077
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                -0.998
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                     2.019
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                   -1.250
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        1.949
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                     2.164
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  0.817
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     1.321
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  1.240
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                     -2.087
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv  -1.221
##                                                                                                                                    Pr(>|t|)
## (Intercept)                                                                                                                          0.0395
## log_delta_pix_h_rel_median_pose_zv                                                                                                   0.2623
## stride_time_median_sec_pose_zv                                                                                                       0.0437
## mean_cadence_step_per_min_pose_zv                                                                                                    0.0454
## stride_width_median_cm_pose_zv                                                                                                       0.0488
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                    0.2832
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                 0.3198
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                     0.0453
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                    0.2134
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                        0.0532
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                     0.0321
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                  0.4155
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                     0.1886
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                  0.2172
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                      0.0387
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv   0.2240
##                                                                                                                                     
## (Intercept)                                                                                                                        *
## log_delta_pix_h_rel_median_pose_zv                                                                                                  
## stride_time_median_sec_pose_zv                                                                                                     *
## mean_cadence_step_per_min_pose_zv                                                                                                  *
## stride_width_median_cm_pose_zv                                                                                                     *
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv                                                                   
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv                                                                
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                                                   *
## log_delta_pix_h_rel_median_pose_zv:stride_width_median_cm_pose_zv                                                                   
## stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                                                      .
## mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                                                   *
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv                                 
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:stride_width_median_cm_pose_zv                                    
## log_delta_pix_h_rel_median_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                 
## stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv                                    *
## log_delta_pix_h_rel_median_pose_zv:stride_time_median_sec_pose_zv:mean_cadence_step_per_min_pose_zv:stride_width_median_cm_pose_zv  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 20.04 on 141 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.5129, Adjusted R-squared:  0.4611 
## F-statistic: 9.898 on 15 and 141 DF,  p-value: 1.041e-15
hist(resid(pws_matvel_multivar_model_2))

# PWS 
# Metrics + disease and demographic info 
# add MS subtype 
pws_matvel_multivar_model_3 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model_3)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed, data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -92.261 -13.998   1.211  15.668  41.027 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                               87.4055    36.8374   2.373 0.018925
## log_delta_pix_h_rel_median_pose_zv         1.9669     4.1449   0.475 0.635805
## stride_time_median_sec_pose_zv           -36.4959    16.4354  -2.221 0.027879
## mean_cadence_step_per_min_pose_zv          0.7136     0.1925   3.706 0.000295
## stride_width_median_cm_pose_zv            -1.0277     0.5762  -1.783 0.076529
## ms_dx_condensedProgressive MS            -13.4480     5.7845  -2.325 0.021422
## ms_dx_condensedMS, Subtype Not Specified  10.4326    15.4306   0.676 0.500021
##                                             
## (Intercept)                              *  
## log_delta_pix_h_rel_median_pose_zv          
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        ***
## stride_width_median_cm_pose_zv           .  
## ms_dx_condensedProgressive MS            *  
## ms_dx_condensedMS, Subtype Not Specified    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.53 on 150 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4022, Adjusted R-squared:  0.3783 
## F-statistic: 16.82 on 6 and 150 DF,  p-value: 8.603e-15
hist(resid(pws_matvel_multivar_model_3))

# add age 
pws_matvel_multivar_model_4 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model_4)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age, 
##     data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -92.606 -12.226   2.035  14.588  41.748 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                              107.5345    37.4285   2.873 0.004659
## log_delta_pix_h_rel_median_pose_zv         2.8095     4.1067   0.684 0.494954
## stride_time_median_sec_pose_zv           -39.2791    16.2634  -2.415 0.016939
## mean_cadence_step_per_min_pose_zv          0.7174     0.1900   3.776 0.000229
## stride_width_median_cm_pose_zv            -1.0270     0.5686  -1.806 0.072899
## ms_dx_condensedProgressive MS             -8.9931     6.0402  -1.489 0.138634
## ms_dx_condensedMS, Subtype Not Specified  16.7838    15.4838   1.084 0.280135
## demoEHR_Age                               -0.3410     0.1513  -2.253 0.025705
##                                             
## (Intercept)                              ** 
## log_delta_pix_h_rel_median_pose_zv          
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        ***
## stride_width_median_cm_pose_zv           .  
## ms_dx_condensedProgressive MS               
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                              *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.24 on 149 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4219, Adjusted R-squared:  0.3947 
## F-statistic: 15.53 on 7 and 149 DF,  p-value: 3.443e-15
hist(resid(pws_matvel_multivar_model_4))

# add disease duration 
pws_matvel_multivar_model_5 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model_5)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration, data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -95.797 -12.299   1.693  14.640  41.342 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                              105.2216    37.4396   2.810 0.005617
## log_delta_pix_h_rel_median_pose_zv         2.4070     4.1168   0.585 0.559652
## stride_time_median_sec_pose_zv           -40.9970    16.3128  -2.513 0.013036
## mean_cadence_step_per_min_pose_zv          0.7289     0.1900   3.836 0.000185
## stride_width_median_cm_pose_zv            -0.9820     0.5693  -1.725 0.086619
## ms_dx_condensedProgressive MS             -8.4398     6.0523  -1.394 0.165263
## ms_dx_condensedMS, Subtype Not Specified  17.1799    15.4701   1.111 0.268574
## demoEHR_Age                               -0.2439     0.1729  -1.410 0.160633
## demoEHR_DiseaseDuration                   -0.2870     0.2481  -1.157 0.249262
##                                             
## (Intercept)                              ** 
## log_delta_pix_h_rel_median_pose_zv          
## stride_time_median_sec_pose_zv           *  
## mean_cadence_step_per_min_pose_zv        ***
## stride_width_median_cm_pose_zv           .  
## ms_dx_condensedProgressive MS               
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.22 on 148 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4271, Adjusted R-squared:  0.3961 
## F-statistic: 13.79 on 8 and 148 DF,  p-value: 7.57e-15
hist(resid(pws_matvel_multivar_model_5))

# add race and ethnicity 
pws_matvel_multivar_model_6 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
                                 stride_time_median_sec_pose_zv + 
                                 mean_cadence_step_per_min_pose_zv + 
                                 stride_width_median_cm_pose_zv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration + 
                                 race_ethnicity_clean, 
                               data = zeno_pws_df)

summary(pws_matvel_multivar_model_6)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_zv + 
##     stride_time_median_sec_pose_zv + mean_cadence_step_per_min_pose_zv + 
##     stride_width_median_cm_pose_zv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = zeno_pws_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -92.842 -11.784   2.359  12.628  40.435 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                    91.9506    38.3256   2.399
## log_delta_pix_h_rel_median_pose_zv              2.4915     4.1081   0.606
## stride_time_median_sec_pose_zv                -35.5615    16.0590  -2.214
## mean_cadence_step_per_min_pose_zv               0.7586     0.1892   4.009
## stride_width_median_cm_pose_zv                 -0.6119     0.5685  -1.076
## ms_dx_condensedProgressive MS                 -11.0238     5.9488  -1.853
## ms_dx_condensedMS, Subtype Not Specified       14.5049    15.0923   0.961
## demoEHR_Age                                    -0.2160     0.1799  -1.201
## demoEHR_DiseaseDuration                        -0.2742     0.2420  -1.133
## race_ethnicity_cleanBlack Or African American -21.6155     9.1324  -2.367
## race_ethnicity_cleanHispanic or Latino          3.5964     8.6421   0.416
## race_ethnicity_cleanWhite Not Hispanic         -0.3255     7.2194  -0.045
## race_ethnicity_cleanOther/Unknown/Declined     -1.1066     9.7475  -0.114
##                                               Pr(>|t|)    
## (Intercept)                                     0.0177 *  
## log_delta_pix_h_rel_median_pose_zv              0.5452    
## stride_time_median_sec_pose_zv                  0.0284 *  
## mean_cadence_step_per_min_pose_zv             9.75e-05 ***
## stride_width_median_cm_pose_zv                  0.2836    
## ms_dx_condensedProgressive MS                   0.0659 .  
## ms_dx_condensedMS, Subtype Not Specified        0.3381    
## demoEHR_Age                                     0.2319    
## demoEHR_DiseaseDuration                         0.2591    
## race_ethnicity_cleanBlack Or African American   0.0193 *  
## race_ethnicity_cleanHispanic or Latino          0.6779    
## race_ethnicity_cleanWhite Not Hispanic          0.9641    
## race_ethnicity_cleanOther/Unknown/Declined      0.9098    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 20.66 on 144 degrees of freedom
##   (60 observations deleted due to missingness)
## Multiple R-squared:  0.4713, Adjusted R-squared:  0.4272 
## F-statistic:  10.7 on 12 and 144 DF,  p-value: 5.858e-15
hist(resid(pws_matvel_multivar_model_6))

Linear Regression –> PWS Velocity Home Video

Demographics Only

home_matvel_dem_model <- lm(PWS_velocitycmsecmean ~ 
                      ms_dx_condensed + 
                      demoEHR_Age + 
                      demoEHR_DiseaseDuration + 
                      race_ethnicity_clean, 
                    data = home_df)

summary(home_matvel_dem_model)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = home_df)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -37.53 -13.44   0.00  16.36  63.21 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                   132.2485    15.7702   8.386
## ms_dx_condensedProgressive MS                 -43.5841     9.3090  -4.682
## ms_dx_condensedMS, Subtype Not Specified       17.3052    12.5899   1.375
## demoEHR_Age                                    -0.1137     0.2730  -0.417
## demoEHR_DiseaseDuration                        -0.3132     0.4720  -0.664
## race_ethnicity_cleanBlack Or African American -72.3140    20.8488  -3.469
## race_ethnicity_cleanHispanic or Latino        -31.1139    21.7722  -1.429
## race_ethnicity_cleanWhite Not Hispanic        -13.6725    11.9575  -1.143
## race_ethnicity_cleanOther/Unknown/Declined     -3.8793    14.4064  -0.269
##                                               Pr(>|t|)    
## (Intercept)                                   2.36e-11 ***
## ms_dx_condensedProgressive MS                 1.95e-05 ***
## ms_dx_condensedMS, Subtype Not Specified       0.17496    
## demoEHR_Age                                    0.67869    
## demoEHR_DiseaseDuration                        0.50978    
## race_ethnicity_cleanBlack Or African American  0.00104 ** 
## race_ethnicity_cleanHispanic or Latino         0.15875    
## race_ethnicity_cleanWhite Not Hispanic         0.25791    
## race_ethnicity_cleanOther/Unknown/Declined     0.78874    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.85 on 54 degrees of freedom
## Multiple R-squared:  0.4843, Adjusted R-squared:  0.4079 
## F-statistic: 6.338 on 8 and 54 DF,  p-value: 8.902e-06
hist(resid(home_matvel_dem_model))

home_matvel_dem_model_2 <- lm(PWS_velocitycmsecmean ~ 
                      ms_dx_condensed + 
                      demoEHR_Age + 
                      demoEHR_DiseaseDuration + 
                      race_ethnicity_clean, 
                    data = home_uniqueid_df)

summary(home_matvel_dem_model_2)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = home_uniqueid_df)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -44.58 -15.01  -0.46  13.61  55.54 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                   129.87748   26.40669   4.918
## ms_dx_condensedProgressive MS                 -34.14761   14.52045  -2.352
## ms_dx_condensedMS, Subtype Not Specified       22.10834   20.87100   1.059
## demoEHR_Age                                    -0.03409    0.46211  -0.074
## demoEHR_DiseaseDuration                        -0.73408    0.80187  -0.915
## race_ethnicity_cleanBlack Or African American -64.58440   34.54653  -1.869
## race_ethnicity_cleanHispanic or Latino        -23.21341   36.39556  -0.638
## race_ethnicity_cleanWhite Not Hispanic        -13.90244   19.81309  -0.702
## race_ethnicity_cleanOther/Unknown/Declined    -11.20032   24.26058  -0.462
##                                               Pr(>|t|)    
## (Intercept)                                   7.27e-05 ***
## ms_dx_condensedProgressive MS                   0.0285 *  
## ms_dx_condensedMS, Subtype Not Specified        0.3015    
## demoEHR_Age                                     0.9419    
## demoEHR_DiseaseDuration                         0.3703    
## race_ethnicity_cleanBlack Or African American   0.0756 .  
## race_ethnicity_cleanHispanic or Latino          0.5305    
## race_ethnicity_cleanWhite Not Hispanic          0.4906    
## race_ethnicity_cleanOther/Unknown/Declined      0.6491    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25.4 on 21 degrees of freedom
## Multiple R-squared:  0.4179, Adjusted R-squared:  0.1962 
## F-statistic: 1.885 on 8 and 21 DF,  p-value: 0.1168
hist(resid(home_matvel_dem_model_2))

# Home videos - pws 

hist(home_df$PWS_velocitycmsecmean)

ggplot(data = home_df, aes(x = log_delta_pix_h_rel_median_pose_hv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 4 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = stride_time_median_sec_pose_hv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 13 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = mean_cadence_step_per_min_pose_hv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 12 rows containing missing values (`geom_point()`).

ggplot(data = home_df, aes(x = stride_width_median_cm_pose_hv, PWS_velocitycmsecmean)) + 
  geom_point()
## Warning: Removed 12 rows containing missing values (`geom_point()`).

## Univariate regressions - each video metric

all videos

metric_regression(home_df, PWS_velocitycmsecmean, log_delta_pix_h_rel_median_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 4 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -68.024 -16.891   5.468  16.520  45.090 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         139.620      8.162  17.106  < 2e-16 ***
## log_delta_pix_h_rel_median_pose_hv   25.141      5.844   4.302 6.72e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 24.29 on 57 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.2451, Adjusted R-squared:  0.2318 
## F-statistic: 18.51 on 1 and 57 DF,  p-value: 6.716e-05

## [1] "PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.622  -7.640   0.074  13.011  31.617 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                   142.3431    16.4143   8.672
## log_delta_pix_h_rel_median_pose_hv             11.3031     5.0772   2.226
## demoEHR_Age                                     0.1397     0.2360   0.592
## demoEHR_DiseaseDuration                         0.2060     0.4105   0.502
## ms_dx_condensedProgressive MS                 -39.3591     7.9626  -4.943
## ms_dx_condensedMS, Subtype Not Specified       -5.5771    10.8498  -0.514
## race_ethnicity_cleanBlack Or African American -81.2997    21.6685  -3.752
## race_ethnicity_cleanHispanic or Latino        -60.3534    18.9177  -3.190
## race_ethnicity_cleanWhite Not Hispanic        -31.3722    11.2719  -2.783
## race_ethnicity_cleanOther/Unknown/Declined    -20.3815    13.0623  -1.560
## clean_sexMale                                  29.2087     7.5998   3.843
## clean_sexNon-Binary                            19.1975    13.4606   1.426
##                                               Pr(>|t|)    
## (Intercept)                                   2.58e-11 ***
## log_delta_pix_h_rel_median_pose_hv            0.030828 *  
## demoEHR_Age                                   0.556642    
## demoEHR_DiseaseDuration                       0.618169    
## ms_dx_condensedProgressive MS                 1.02e-05 ***
## ms_dx_condensedMS, Subtype Not Specified      0.609640    
## race_ethnicity_cleanBlack Or African American 0.000481 ***
## race_ethnicity_cleanHispanic or Latino        0.002532 ** 
## race_ethnicity_cleanWhite Not Hispanic        0.007727 ** 
## race_ethnicity_cleanOther/Unknown/Declined    0.125389    
## clean_sexMale                                 0.000363 ***
## clean_sexNon-Binary                           0.160421    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 17.56 on 47 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.6747, Adjusted R-squared:  0.5985 
## F-statistic: 8.861 on 11 and 47 DF,  p-value: 2.983e-08

metric_regression(home_df, PWS_velocitycmsecmean, stride_time_median_sec_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 13 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ stride_time_median_sec_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -46.309 -20.619   2.342  19.588  38.570 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      186.63      16.10  11.592 1.62e-15 ***
## stride_time_median_sec_pose_hv   -67.65      13.30  -5.088 5.97e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 23.31 on 48 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.3504, Adjusted R-squared:  0.3369 
## F-statistic: 25.89 on 1 and 48 DF,  p-value: 5.965e-06

## [1] "PWS_velocitycmsecmean ~ stride_time_median_sec_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -34.464 -13.405   0.722  15.687  29.795 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                160.1095    31.2348   5.126 7.92e-06
## stride_time_median_sec_pose_hv             -23.3736    22.9108  -1.020  0.31377
## demoEHR_Age                                  0.1376     0.3046   0.452  0.65402
## demoEHR_DiseaseDuration                     -0.1370     0.4739  -0.289  0.77403
## ms_dx_condensedProgressive MS              -34.8772    17.9607  -1.942  0.05922
## ms_dx_condensedMS, Subtype Not Specified     3.6553    12.5589   0.291  0.77251
## race_ethnicity_cleanHispanic or Latino     -55.2931    22.2496  -2.485  0.01723
## race_ethnicity_cleanWhite Not Hispanic     -35.1292    15.2223  -2.308  0.02627
## race_ethnicity_cleanOther/Unknown/Declined -18.7907    15.7768  -1.191  0.24066
## clean_sexMale                               28.9573     9.7313   2.976  0.00494
##                                               
## (Intercept)                                ***
## stride_time_median_sec_pose_hv                
## demoEHR_Age                                   
## demoEHR_DiseaseDuration                       
## ms_dx_condensedProgressive MS              .  
## ms_dx_condensedMS, Subtype Not Specified      
## race_ethnicity_cleanHispanic or Latino     *  
## race_ethnicity_cleanWhite Not Hispanic     *  
## race_ethnicity_cleanOther/Unknown/Declined    
## clean_sexMale                              ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.27 on 40 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.6298, Adjusted R-squared:  0.5465 
## F-statistic: 7.562 on 9 and 40 DF,  p-value: 2.276e-06

metric_regression(home_df, PWS_velocitycmsecmean, mean_cadence_step_per_min_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 12 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ mean_cadence_step_per_min_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -63.449 -18.164   7.176  19.931  41.250 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                        63.7198    22.1577   2.876  0.00595 **
## mean_cadence_step_per_min_pose_hv   0.4228     0.2129   1.986  0.05264 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27.84 on 49 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.0745, Adjusted R-squared:  0.05561 
## F-statistic: 3.944 on 1 and 49 DF,  p-value: 0.05264

## [1] "PWS_velocitycmsecmean ~ mean_cadence_step_per_min_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -34.860 -13.445  -0.673  14.720  29.959 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                151.1000    25.8511   5.845 7.19e-07
## mean_cadence_step_per_min_pose_hv           -0.1668     0.1845  -0.904  0.37105
## demoEHR_Age                                  0.1525     0.2872   0.531  0.59831
## demoEHR_DiseaseDuration                     -0.0473     0.4602  -0.103  0.91863
## ms_dx_condensedProgressive MS              -56.6810    11.0208  -5.143 7.07e-06
## ms_dx_condensedMS, Subtype Not Specified     0.1384    11.9538   0.012  0.99082
## race_ethnicity_cleanHispanic or Latino     -57.7120    21.9668  -2.627  0.01205
## race_ethnicity_cleanWhite Not Hispanic     -34.9418    15.0535  -2.321  0.02533
## race_ethnicity_cleanOther/Unknown/Declined -20.6330    15.6255  -1.320  0.19400
## clean_sexMale                               27.6721     8.8391   3.131  0.00321
##                                               
## (Intercept)                                ***
## mean_cadence_step_per_min_pose_hv             
## demoEHR_Age                                   
## demoEHR_DiseaseDuration                       
## ms_dx_condensedProgressive MS              ***
## ms_dx_condensedMS, Subtype Not Specified      
## race_ethnicity_cleanHispanic or Latino     *  
## race_ethnicity_cleanWhite Not Hispanic     *  
## race_ethnicity_cleanOther/Unknown/Declined    
## clean_sexMale                              ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.1 on 41 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.6357, Adjusted R-squared:  0.5557 
## F-statistic: 7.949 on 9 and 41 DF,  p-value: 1.109e-06

metric_regression(home_df, PWS_velocitycmsecmean, stride_width_median_cm_pose_hv)
## [1] "Data Frame:  home_df"
## Warning: Removed 12 rows containing missing values (`geom_point()`).

## [1] "PWS_velocitycmsecmean ~ stride_width_median_cm_pose_hv"
## 
## Call:
## lm(formula = as.formula(outcome_predictor_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -67.022 -17.917   4.952  20.778  36.575 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     165.805     19.453   8.523 3.06e-11 ***
## stride_width_median_cm_pose_hv   -4.627      1.503  -3.077  0.00341 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.49 on 49 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.162,  Adjusted R-squared:  0.1449 
## F-statistic:  9.47 on 1 and 49 DF,  p-value: 0.003414

## [1] "PWS_velocitycmsecmean ~ stride_width_median_cm_pose_hv + demoEHR_Age + demoEHR_DiseaseDuration + \n                      ms_dx_condensed + \n                      race_ethnicity_clean + \n                      clean_sex"
## 
## Call:
## lm(formula = as.formula(full_formula_string), data = data_frame)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -42.207 -11.526   1.933  14.318  28.690 
## 
## Coefficients:
##                                            Estimate Std. Error t value Pr(>|t|)
## (Intercept)                                157.1320    20.8368   7.541 2.87e-09
## stride_width_median_cm_pose_hv              -2.2176     1.2391  -1.790  0.08090
## demoEHR_Age                                  0.2344     0.2808   0.835  0.40881
## demoEHR_DiseaseDuration                     -0.1056     0.4454  -0.237  0.81370
## ms_dx_condensedProgressive MS              -44.4757     9.3356  -4.764 2.39e-05
## ms_dx_condensedMS, Subtype Not Specified     6.1075    11.9402   0.512  0.61174
## race_ethnicity_cleanHispanic or Latino     -52.9084    21.4785  -2.463  0.01805
## race_ethnicity_cleanWhite Not Hispanic     -36.0332    14.6224  -2.464  0.01801
## race_ethnicity_cleanOther/Unknown/Declined -20.5413    15.1766  -1.353  0.18332
## clean_sexMale                               29.0007     8.5349   3.398  0.00152
##                                               
## (Intercept)                                ***
## stride_width_median_cm_pose_hv             .  
## demoEHR_Age                                   
## demoEHR_DiseaseDuration                       
## ms_dx_condensedProgressive MS              ***
## ms_dx_condensedMS, Subtype Not Specified      
## race_ethnicity_cleanHispanic or Latino     *  
## race_ethnicity_cleanWhite Not Hispanic     *  
## race_ethnicity_cleanOther/Unknown/Declined    
## clean_sexMale                              ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.57 on 41 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.6554, Adjusted R-squared:  0.5797 
## F-statistic: 8.663 on 9 and 41 DF,  p-value: 3.925e-07

### Multivariate regression Metrics only

# Metrics only - not including double support/stance measures, too many missing 
# confounding + 
home_matvel_multivar_model <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv, 
                               data = home_df)

summary(home_matvel_multivar_model)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv, data = home_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -44.785 -15.884   0.673  14.749  38.539 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        217.21836   41.01864   5.296 3.61e-06 ***
## log_delta_pix_h_rel_median_pose_hv  30.36748   10.52959   2.884  0.00606 ** 
## stride_time_median_sec_pose_hv     -36.34131   19.91545  -1.825  0.07483 .  
## mean_cadence_step_per_min_pose_hv   -0.07951    0.22508  -0.353  0.72560    
## stride_width_median_cm_pose_hv      -1.82893    1.40931  -1.298  0.20114    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 20.84 on 44 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.5073, Adjusted R-squared:  0.4625 
## F-statistic: 11.32 on 4 and 44 DF,  p-value: 2.1e-06
hist(resid(home_matvel_multivar_model))

# PWS interaction * 
home_matvel_multivar_model_2 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv * 
                                 stride_time_median_sec_pose_hv * 
                                 mean_cadence_step_per_min_pose_hv * 
                                 stride_width_median_cm_pose_hv, 
                               data = home_df)

summary(home_matvel_multivar_model_2)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv * 
##     stride_time_median_sec_pose_hv * mean_cadence_step_per_min_pose_hv * 
##     stride_width_median_cm_pose_hv, data = home_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -31.174  -9.053   0.587  11.557  32.855 
## 
## Coefficients:
##                                                                                                                                      Estimate
## (Intercept)                                                                                                                         1739.6382
## log_delta_pix_h_rel_median_pose_hv                                                                                                  3006.9649
## stride_time_median_sec_pose_hv                                                                                                       239.6412
## mean_cadence_step_per_min_pose_hv                                                                                                     -8.1459
## stride_width_median_cm_pose_hv                                                                                                         7.9417
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                  -1521.6538
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                 -27.9368
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                      -8.5989
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                   -147.9248
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                       -126.6266
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                      -0.6585
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                   14.0448
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                      54.0092
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                    1.3684
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                        1.7265
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv    -0.4769
##                                                                                                                                    Std. Error
## (Intercept)                                                                                                                         2953.2033
## log_delta_pix_h_rel_median_pose_hv                                                                                                  2554.3622
## stride_time_median_sec_pose_hv                                                                                                      2637.5459
## mean_cadence_step_per_min_pose_hv                                                                                                     34.7329
## stride_width_median_cm_pose_hv                                                                                                       191.2697
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                   2112.0019
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                  30.2273
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                      32.4043
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                    164.3328
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                        170.4884
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                       2.2957
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                   26.4519
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                     132.4251
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                    2.0017
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                        2.1575
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv     1.7381
##                                                                                                                                    t value
## (Intercept)                                                                                                                          0.589
## log_delta_pix_h_rel_median_pose_hv                                                                                                   1.177
## stride_time_median_sec_pose_hv                                                                                                       0.091
## mean_cadence_step_per_min_pose_hv                                                                                                   -0.235
## stride_width_median_cm_pose_hv                                                                                                       0.042
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                   -0.720
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                -0.924
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                    -0.265
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                   -0.900
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                       -0.743
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                    -0.287
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                  0.531
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                     0.408
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                  0.684
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                      0.800
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv  -0.274
##                                                                                                                                    Pr(>|t|)
## (Intercept)                                                                                                                           0.560
## log_delta_pix_h_rel_median_pose_hv                                                                                                    0.248
## stride_time_median_sec_pose_hv                                                                                                        0.928
## mean_cadence_step_per_min_pose_hv                                                                                                     0.816
## stride_width_median_cm_pose_hv                                                                                                        0.967
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv                                                                     0.476
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv                                                                  0.362
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                                                      0.792
## log_delta_pix_h_rel_median_pose_hv:stride_width_median_cm_pose_hv                                                                     0.375
## stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                                                         0.463
## mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                                                      0.776
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv                                   0.599
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:stride_width_median_cm_pose_hv                                      0.686
## log_delta_pix_h_rel_median_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                   0.499
## stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv                                       0.429
## log_delta_pix_h_rel_median_pose_hv:stride_time_median_sec_pose_hv:mean_cadence_step_per_min_pose_hv:stride_width_median_cm_pose_hv    0.785
## 
## Residual standard error: 18.31 on 33 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.7148, Adjusted R-squared:  0.5851 
## F-statistic: 5.513 on 15 and 33 DF,  p-value: 2.178e-05
hist(resid(home_matvel_multivar_model_2))

# Metrics + disease and demographic info 
# add MS subtype 
home_matvel_multivar_model_3 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv + 
                                 ms_dx_condensed, 
                               data = home_df)

summary(home_matvel_multivar_model_3)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed, data = home_df)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -43.66 -13.11  -0.56  13.79  38.14 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                              178.5746    42.5981   4.192 0.000139
## log_delta_pix_h_rel_median_pose_hv        19.5787    10.7021   1.829 0.074441
## stride_time_median_sec_pose_hv             3.9832    25.2979   0.157 0.875642
## mean_cadence_step_per_min_pose_hv         -0.1467     0.2131  -0.689 0.494917
## stride_width_median_cm_pose_hv            -2.6326     1.4142  -1.862 0.069666
## ms_dx_condensedProgressive MS            -44.1841    18.1056  -2.440 0.018972
## ms_dx_condensedMS, Subtype Not Specified  11.8323    11.2474   1.052 0.298814
##                                             
## (Intercept)                              ***
## log_delta_pix_h_rel_median_pose_hv       .  
## stride_time_median_sec_pose_hv              
## mean_cadence_step_per_min_pose_hv           
## stride_width_median_cm_pose_hv           .  
## ms_dx_condensedProgressive MS            *  
## ms_dx_condensedMS, Subtype Not Specified    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.59 on 42 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.5844, Adjusted R-squared:  0.5251 
## F-statistic: 9.844 on 6 and 42 DF,  p-value: 9.041e-07
hist(resid(home_matvel_multivar_model_3))

# add age 
home_matvel_multivar_model_4 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age, 
                               data = home_df)

summary(home_matvel_multivar_model_4)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed + demoEHR_Age, 
##     data = home_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -40.391 -13.190   1.107  15.944  38.803 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                              193.3250    44.7742   4.318 9.74e-05
## log_delta_pix_h_rel_median_pose_hv        17.5002    10.8671   1.610   0.1150
## stride_time_median_sec_pose_hv            -4.0523    26.3843  -0.154   0.8787
## mean_cadence_step_per_min_pose_hv         -0.1557     0.2129  -0.731   0.4687
## stride_width_median_cm_pose_hv            -2.2229     1.4645  -1.518   0.1367
## ms_dx_condensedProgressive MS            -39.7174    18.5690  -2.139   0.0384
## ms_dx_condensedMS, Subtype Not Specified  16.4033    12.0371   1.363   0.1804
## demoEHR_Age                               -0.2525     0.2391  -1.056   0.2971
##                                             
## (Intercept)                              ***
## log_delta_pix_h_rel_median_pose_hv          
## stride_time_median_sec_pose_hv              
## mean_cadence_step_per_min_pose_hv           
## stride_width_median_cm_pose_hv              
## ms_dx_condensedProgressive MS            *  
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.56 on 41 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.5954, Adjusted R-squared:  0.5264 
## F-statistic:  8.62 on 7 and 41 DF,  p-value: 1.825e-06
hist(resid(home_matvel_multivar_model_4))

# add disease duration 
home_matvel_multivar_model_5 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration, 
                               data = home_df)

summary(home_matvel_multivar_model_5)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration, data = home_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.656 -13.530   0.656  15.458  37.868 
## 
## Coefficients:
##                                          Estimate Std. Error t value Pr(>|t|)
## (Intercept)                              194.6680    45.5440   4.274 0.000115
## log_delta_pix_h_rel_median_pose_hv        17.6598    11.0065   1.604 0.116475
## stride_time_median_sec_pose_hv            -4.7910    26.8185  -0.179 0.859117
## mean_cadence_step_per_min_pose_hv         -0.1608     0.2161  -0.744 0.461329
## stride_width_median_cm_pose_hv            -2.2169     1.4815  -1.496 0.142390
## ms_dx_condensedProgressive MS            -39.9088    18.7942  -2.123 0.039951
## ms_dx_condensedMS, Subtype Not Specified  16.6309    12.2025   1.363 0.180534
## demoEHR_Age                               -0.2233     0.2637  -0.847 0.402120
## demoEHR_DiseaseDuration                   -0.1169     0.4207  -0.278 0.782602
##                                             
## (Intercept)                              ***
## log_delta_pix_h_rel_median_pose_hv          
## stride_time_median_sec_pose_hv              
## mean_cadence_step_per_min_pose_hv           
## stride_width_median_cm_pose_hv              
## ms_dx_condensedProgressive MS            *  
## ms_dx_condensedMS, Subtype Not Specified    
## demoEHR_Age                                 
## demoEHR_DiseaseDuration                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.78 on 40 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.5962, Adjusted R-squared:  0.5155 
## F-statistic: 7.383 on 8 and 40 DF,  p-value: 5.496e-06
hist(resid(home_matvel_multivar_model_5))

# add race and ethnicity 
home_matvel_multivar_model_6 <- lm(PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
                                 stride_time_median_sec_pose_hv + 
                                 mean_cadence_step_per_min_pose_hv + 
                                 stride_width_median_cm_pose_hv + 
                                 ms_dx_condensed + 
                                 demoEHR_Age + 
                                 demoEHR_DiseaseDuration + 
                                 race_ethnicity_clean, 
                               data = home_df)

summary(home_matvel_multivar_model_6)
## 
## Call:
## lm(formula = PWS_velocitycmsecmean ~ log_delta_pix_h_rel_median_pose_hv + 
##     stride_time_median_sec_pose_hv + mean_cadence_step_per_min_pose_hv + 
##     stride_width_median_cm_pose_hv + ms_dx_condensed + demoEHR_Age + 
##     demoEHR_DiseaseDuration + race_ethnicity_clean, data = home_df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -41.954 -11.525   1.007  13.271  40.271 
## 
## Coefficients:
##                                             Estimate Std. Error t value
## (Intercept)                                198.11475   45.35758   4.368
## log_delta_pix_h_rel_median_pose_hv          23.50946   10.84331   2.168
## stride_time_median_sec_pose_hv               2.23808   25.94949   0.086
## mean_cadence_step_per_min_pose_hv           -0.13102    0.21082  -0.621
## stride_width_median_cm_pose_hv              -1.70982    1.45321  -1.177
## ms_dx_condensedProgressive MS              -40.98916   18.23476  -2.248
## ms_dx_condensedMS, Subtype Not Specified     9.05339   12.36775   0.732
## demoEHR_Age                                 -0.02147    0.28319  -0.076
## demoEHR_DiseaseDuration                      0.15047    0.47339   0.318
## race_ethnicity_cleanHispanic or Latino     -55.28232   22.30640  -2.478
## race_ethnicity_cleanWhite Not Hispanic     -27.65538   14.74643  -1.875
## race_ethnicity_cleanOther/Unknown/Declined -25.00977   15.72431  -1.591
##                                            Pr(>|t|)    
## (Intercept)                                9.74e-05 ***
## log_delta_pix_h_rel_median_pose_hv           0.0367 *  
## stride_time_median_sec_pose_hv               0.9317    
## mean_cadence_step_per_min_pose_hv            0.5381    
## stride_width_median_cm_pose_hv               0.2469    
## ms_dx_condensedProgressive MS                0.0306 *  
## ms_dx_condensedMS, Subtype Not Specified     0.4688    
## demoEHR_Age                                  0.9400    
## demoEHR_DiseaseDuration                      0.7524    
## race_ethnicity_cleanHispanic or Latino       0.0179 *  
## race_ethnicity_cleanWhite Not Hispanic       0.0686 .  
## race_ethnicity_cleanOther/Unknown/Declined   0.1202    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 19.02 on 37 degrees of freedom
##   (14 observations deleted due to missingness)
## Multiple R-squared:  0.6548, Adjusted R-squared:  0.5521 
## F-statistic:  6.38 on 11 and 37 DF,  p-value: 8.558e-06
hist(resid(home_matvel_multivar_model_6))

Home Video significant association of PWS velocity with log delta pix h rel median after adjusting for dem and disease info

Linear Regression –> FW velocity (check distribution)

FW Zeno videos

Ordinal Regression –> EDSS